Read the problem statement and look at the sample output, there are two spaces after each number.
Post your updated code if you still want help. Also use the code blocks when posting code.
382 - Perfection
Moderator: Board moderators
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 382 - Perfection getting WA
Check input and AC output for thousands of problems on uDebug!
Re: 382 - Perfection getting WA
Thanks a lot, Accepted after using two spaces .
Re: 382 - Perfection
1 < N < 100
So input 1 is invalid. Moreover, how can 1 be deficient?
1 = 1*1 *1 *1 *1......
1> summation of it product
So input 1 is invalid. Moreover, how can 1 be deficient?
1 = 1*1 *1 *1 *1......
1> summation of it product
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 382 - Perfection
1 does appear in the judge's input and in order to get AC you need to print deficient.
Check input and AC output for thousands of problems on uDebug!
Re: 382 - Perfection
presentation error:
Code: Select all
#include<stdio.h>
int main()
{
long long int i,n,j,count=0;
for( ; ; )
{
long long int sum=0;
scanf("%lld",&n);
if(n==0)
{
printf("END OF OUTPUT\n");
break;
}
if(count!=1)
{
printf("PERFECTION OUTPUT\n");
}
count=1;
for(i=1;i<=n/2;i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
{
printf("%lld PERFECT\n",n);
}
else if(sum>n)
{
printf("%lld ABUNDANT\n",n);
}
else if(sum<n)
{
printf("%lld DEFICIENT\n",n);
}
}
return 0;
}
Last edited by brianfry713 on Fri Feb 06, 2015 10:36 pm, edited 1 time in total.
Reason: Added code blocks
Reason: Added code blocks
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 382 - Perfection
Format counts: the echoed integers should be right justified within the first 5 spaces of the output line, followed by two blank spaces, followed by the description of the integer.
Check input and AC output for thousands of problems on uDebug!