382 - Perfection

All about problems in Volume 3. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

bongssi
New poster
Posts: 14
Joined: Mon Jul 31, 2006 10:35 am

382 WA...

Post by bongssi » Tue Aug 01, 2006 1:17 am

I checked 1 is deficient. I don't know why I got WA. Plz help me~!
Here is my code.

The code is deleted after AC.
Last edited by bongssi on Wed Aug 02, 2006 10:46 am, edited 1 time in total.

User avatar
linux
Learning poster
Posts: 56
Joined: Sat Jul 01, 2006 12:21 pm
Location: CA-95054
Contact:

382 An easy problem!

Post by linux » Tue Aug 01, 2006 1:42 pm

You've done a mistake according to judges output.
in your code after printf
END OF OUTPUT
not END_OF_OUTPUT!
I think it's why you are getting wrong answer from the particular problem.
Also you'll get presentation error for

Code: Select all

printf("%5d ", number);
But you should print

Code: Select all

printf("%5d  ", number);
means two spaces after right justification.
Last edited by linux on Sat Sep 16, 2006 2:27 pm, edited 1 time in total.
Solving for fun..

bongssi
New poster
Posts: 14
Joined: Mon Jul 31, 2006 10:35 am

Oh, thank you very much!

Post by bongssi » Wed Aug 02, 2006 10:35 am

I noticed I commit a stupid mistake. I modified my source and got AC for this problem. Thank you very much :)

hf_1992
New poster
Posts: 4
Joined: Sat Nov 11, 2006 6:44 am

382 WA

Post by hf_1992 » Tue Nov 14, 2006 4:17 pm

Del after AC
Last edited by hf_1992 on Sun Nov 19, 2006 11:33 am, edited 1 time in total.

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Tue Nov 14, 2006 5:00 pm

there are a lot of threads on this problem..
search first..
if you need to post, use old one to post..

User avatar
Oronno
New poster
Posts: 21
Joined: Sun Jul 09, 2006 1:42 pm
Location: Dhaka
Contact:

Why Presentation Error on 382???

Post by Oronno » Thu Dec 21, 2006 5:26 pm

I have solve it and check it that it works with correct output format.
after submitting, i get PE.
But i sure, i do it as it say in sample output format.
I am afraid on ACM!!! :roll:


Code: Select all

Code has removed
Last edited by Oronno on Sat Dec 23, 2006 7:11 pm, edited 1 time in total.
I like programming but i am so lazy to do it...

joy
New poster
Posts: 48
Joined: Wed Oct 18, 2006 1:00 pm
Location: Dhaka, Bangladesh
Contact:

Post by joy » Thu Dec 21, 2006 6:49 pm

print a new line after "END OF OUTPUT" that is...
printf("END OF OUTPUT\n");

Dont open a new thread if there is one already. If there is no thread then open a new one.
remove your code after AC
form kisui na ... class tai asol....
iF U hv d class u get the form....

rana_cse_ruet
New poster
Posts: 7
Joined: Mon Mar 05, 2007 9:59 am

382,wrong answer

Post by rana_cse_ruet » Sun Apr 29, 2007 6:09 pm

I can't guess why the following code is getting WA. Can anyone help me out, plz... ??

Code: Select all

#include<iostream.h>
#include<iomanip.h>

#include<stdio.h>

void main()
{
	 
	long int i;
	long int x,sum;

	cout<<"PERFECTION OUTPUT\n";
	while(cin>>x&&x)
	{
		 
		sum=1;
		for(i=2;i<=x/2;i++)
		{
			if(x%i==0)
			{
			 sum+=i;
			}

		}
		 
		if(sum==x)
			cout<<setw(5)<<x<<"  PERFECT\n";
		else if(sum<x)
			cout<<setw(5)<<x<<"  DEFICIENT\n";
		else 
			cout<<setw(5)<<x<<"  ABUNDANT\n";
	}
	cout<<"END OF OUTPUT";
	 
}

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Sun Apr 29, 2007 7:16 pm

Don't open a new thread if there is one already.
Ami ekhono shopno dekhi...
HomePage

scott1991
New poster
Posts: 28
Joined: Fri Dec 07, 2007 11:41 pm

I need help too...

Post by scott1991 » Fri Dec 07, 2007 11:47 pm

I was wondering why mine is wrong...It gives me all the correct answers but gives wa when submitted.

Code: Select all

AC Now!!
thanks for any help.

[Edited by Jan. pls use code tags]
Last edited by scott1991 on Fri Mar 07, 2008 11:21 pm, edited 1 time in total.

Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan » Sun Dec 09, 2007 8:29 pm

Increase the size of your array.
Ami ekhono shopno dekhi...
HomePage

scott1991
New poster
Posts: 28
Joined: Fri Dec 07, 2007 11:41 pm

Post by scott1991 » Thu Dec 13, 2007 9:12 pm

done that but still get wa...any other ideas? Cheers.

Code now:

Code: Select all

Ac now!!
Last edited by scott1991 on Fri Mar 07, 2008 11:21 pm, edited 1 time in total.

Jolanda
New poster
Posts: 2
Joined: Fri Dec 21, 2007 11:17 am

Post by Jolanda » Fri Dec 21, 2007 7:19 pm

I got RE on my code, why???

Code:
import java.io.*;
import java.util.*;

public class Main {
public static void main(String[] args) throws IOException {
BufferedReader vhod = new BufferedReader(new InputStreamReader(System.in));
int[] tab = new int[100];
int k = 0;

String line = vhod.readLine();
StringTokenizer num = new StringTokenizer(line, " ");
while (true) {
int a = Integer.parseInt(num.nextToken());
if (a == 0) break;
tab[k++] = a;
}

int[] rez = solve(tab);

System.out.println();
System.out.println("PERFECTION OUTPUT");
for (int i = 0; i < k; i++) {
int d = (Integer.toString(tab)).length();
if (d == 1) System.out.print(" ");
if (d == 2) System.out.print(" ");
if (d == 3) System.out.print(" ");
if (d == 4) System.out.print(" ");
System.out.print(tab + " ");
if (rez == 0) System.out.println("PERFECT");
if (rez == -1) System.out.println("DEFICIENT");
if (rez == 1) System.out.println("ABUNDANT");
}
System.out.println("END OF OUTPUT");
}


public static int[] solve(int[] tab) {
int n = tab.length;
int[] rez = new int[n];
for (int i = 0; i < n; i++) {
int d = sum(tab);
if (d < tab) rez = -1;
if (d > tab) rez = 1;
}
return rez;
}


public static int sum(int a) {
int v = 1;
for (int i = 2; i < a; i++) {
if (a%i == 0) v += i;
}
return v;
}
}

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.

Why i got RE..

Post by Obaida » Mon Mar 03, 2008 8:59 am

Some one please help me I got RE.....

Code: Select all

Removed
[code]
Last edited by Obaida on Tue Mar 04, 2008 9:08 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

CSEDU_1323
New poster
Posts: 10
Joined: Mon Feb 25, 2008 8:22 pm
Location: Dhaka, Bangladesh.

Post by CSEDU_1323 » Mon Mar 03, 2008 3:46 pm

if n==1 then it is deficient

&&

in D input() scanf(); use %ld instead %d

HOPE THIS HELP
--- B HAPPY & KEEP SMILING ------

Post Reply

Return to “Volume 3 (300-399)”