Page 10 of 14

Posted: Fri Aug 25, 2006 10:49 am
by kolpobilashi
check your code for input greater than 52. your output format doesn't match with sample output.
change :

Code: Select all

if(k>15) printf("\n "); 
to:

Code: Select all

if(k>15) printf("\n      "); 
and also you forget to check another thing.
change:

Code: Select all

for(i=0;a[i]<=n;i++) 
to:

Code: Select all

for(i=0;a[i]<=n&&i<25;i++) 
best regards. :)

Posted: Tue Aug 29, 2006 9:20 am
by srabon
Sanjana apu thanks a lot . I got ACC. I think you are so brilliant. :D

160 - Factors and Factorials

Posted: Sun Sep 03, 2006 10:17 am
by nafi1212
I get WA for 160.

#include <vector>
#include <stdio.h>

#include <list>
using namespace std;
int primes[] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};

int p160(int x, int i, vector<int>::iterator counter)
{
if((x%primes)==0){
counter++;
if((x/primes)!=1)
p160(x/primes,i,counter);
else
return 1;
}else{
p160(x,i+1, counter);
}
return 1;
}
int p160(int x)
{
vector<int>counter(25,0);
for(int i=2;i<=x;i++)
p160(i,0, counter.begin());
while(!counter.back()){
counter.pop_back();
};
printf("%3d! =", x);
for(unsigned int i=0;i<counter.size();i++){

printf("%3d", counter);
if(i==14){
printf("\n ");
}
}
printf("\n");
return 1;
}
int main()
{
vector<int>nums;
for(;;){
int tmp;
fscanf(stdin, "%d", &tmp);
if(!tmp)
break;
if(tmp<2||tmp>100)
continue;
nums.push_back(tmp);

}
for(unsigned int i=0;i<nums.size();i++){
p160(nums);
}
return 1;

}

Re: 160 WA?? PLZ

Posted: Sun Sep 03, 2006 5:33 pm
by tan_Yui
Read the problem description, then check again the output format :wink:
After fixed it, you'll get Accepted.

Best regards.

Posted: Sun Sep 03, 2006 11:06 pm
by nafi1212
After editing output, GOT AAC, many thanks tan_yui

160-wa

Posted: Mon Oct 16, 2006 9:49 pm
by john_locke
here is my code cant find the error values are correct, format is correct but still get WA.....
so plz help me
CODE IS DELETED

thanx in advance[/quote]

160 - WA

Posted: Sat Nov 04, 2006 7:41 pm
by CrazyTerabyte
Instead of starting a new thread, I will post in this one.

Here is my code: (deleted)

I've tested it for all numbers from 2 to 100. The output looks correct to me. But I still get wrong answer. Can someone help me?

Re: 160 - WA

Posted: Sat Nov 04, 2006 8:31 pm
by helloneo
CrazyTerabyte wrote:Instead of starting a new thread, I will post in this one.

Here is my code:
I've tested it for all numbers from 2 to 100. The output looks correct to me. But I still get wrong answer. Can someone help me?
Your ouput is wrong..
Try this input

Code: Select all

1
2
3
4
5
100
0
My output

Code: Select all

  1! =  0
  2! =  1
  3! =  1  1
  4! =  3  1
  5! =  3  1  1
100! = 97 48 24 16  9  7  5  5  4  3  3  2  2  2  2
        1  1  1  1  1  1  1  1  1  1
Your output

Code: Select all

  1! =  0
  2! =  0
  3! =  1
  4! =  1
  5! =  1  1
100! = 48 24 16  9  7  5  5  4  3  3  2  2  2  2  1
        1  1  1  1  1  1  1  1  1

Re: 160 - WA

Posted: Sat Nov 04, 2006 8:39 pm
by CrazyTerabyte
helloneo wrote:Your ouput is wrong..
Try this input
I got exactly the same output as yours.

hum... After some time finally I found I was not initializing ONE position in my array. After fixed that, I got accepted.

Thanks.

Posted: Sun Nov 05, 2006 9:05 pm
by nafi1212
Ur programme doesn't output the result in correct format.
Example

Code: Select all

63
ur prog's output is:

Code: Select all

 
63! = 57 30 14 10  5  4  3  3  2  2  2  1  1  1  1
   1  1  1
But It should be:

Code: Select all

 63! = 57 30 14 10  5  4  3  3  2  2  2  1  1  1  1
           1   1   1
[/list]

Posted: Fri Nov 10, 2006 3:46 pm
by john_locke
Thanx nafi
got ACC :D after 30 submission

Posted: Fri Nov 24, 2006 6:17 pm
by albet_januar

Code: Select all

deleted after Ac.. at last, i know my mistake.. hikx
thx

Posted: Fri Nov 24, 2006 7:15 pm
by rio
I run your code with my PC, and it even doesn't pass the sample.
Try debug at least you pass the sample.

Posted: Sat Nov 25, 2006 8:36 pm
by albet_januar
i change my code.. but still it WA.. dun know why..

Posted: Sat Nov 25, 2006 11:37 pm
by tan_Yui

Code: Select all

         if(hasil[i]) 
         { 
            else printf("%3lld", hasil[i]); 
            counter++; 
         }
In this part, 'else' is illegal then return compile error.
By the way, there are already many many threads about problem 160.
http://online-judge.uva.es/board/search.php
Did you check all posts from here?
There are a lot of test data, so you can use it for debugging.

Best regards.