10106 - Product

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

Moderator: Board moderators

Scarecrow
Learning poster
Posts: 69
Joined: Wed Oct 19, 2011 9:06 pm

Re: 10106 - Product

Post by Scarecrow » Tue Jan 03, 2012 5:55 pm

i can't figure it out what's wrong with my code. continuously getting WA :( seems no error, no mismatch with any of the test cases..
can sm1 help me?

Code: Select all

removed after correction
Last edited by Scarecrow on Fri Jan 20, 2012 10:09 pm, edited 1 time in total.
Do or do not. There is no try.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10106 - Product

Post by brianfry713 » Tue Jan 10, 2012 3:10 am

Scarecrow, your code fails for input:

Code: Select all

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
Correct output:

Code: Select all

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
Check input and AC output for thousands of problems on uDebug!

Scarecrow
Learning poster
Posts: 69
Joined: Wed Oct 19, 2011 9:06 pm

Re: 10106 - Product

Post by Scarecrow » Fri Jan 20, 2012 10:08 pm

brianfry713 wrote:Scarecrow, your code fails for input:

Code: Select all

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
Correct output:

Code: Select all

999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001

many many thnx brianfry713 :D sorted out the problem, the limit of the temp string wasn't sufficient. thnx :D
Do or do not. There is no try.

asitmahato
New poster
Posts: 11
Joined: Mon Feb 20, 2012 11:04 am

10106 - Product

Post by asitmahato » Mon Feb 20, 2012 11:20 am

I can't find out why this code is giving WA.
Here the code..

Code: Select all

code removed after AC.
plz help me out..

Thanks In advance..
Last edited by asitmahato on Tue Feb 21, 2012 5:59 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10106 - Product

Post by brianfry713 » Tue Feb 21, 2012 9:28 am

Change line 35 to this
for(i=0;i<100000;i++)if(s) break;
Check input and AC output for thousands of problems on uDebug!

asitmahato
New poster
Posts: 11
Joined: Mon Feb 20, 2012 11:04 am

Re: 10106 - Product

Post by asitmahato » Wed Feb 22, 2012 5:23 am

Thank you very very much..
brianfry713 wrote:Change line 35 to this
for(i=0;i<100000;i++)if(s) break;

can you explain it to me please .

for faster communication you can rply me at asitmahato@sh00nya.in..

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10106 - Product

Post by brianfry713 » Thu Feb 23, 2012 6:06 am

s was declared as:
int s[100000]={0};

So you shouldn't try and access memory beyond s[99999] or you'll get somewhat unpredictable results or a seg fault.

Your main issue was the following line was checking if i==100000, but if the memory at s[100000] was 0, then i would be greater than 100000 and you wouldn't get any results for that test case (when a or b is zero).
Check input and AC output for thousands of problems on uDebug!

asitmahato
New poster
Posts: 11
Joined: Mon Feb 20, 2012 11:04 am

Re: 10106 - Product

Post by asitmahato » Thu Feb 23, 2012 3:55 pm

Thank you very very much..

Integral
New poster
Posts: 5
Joined: Tue May 22, 2012 8:09 am

Re: 10106 - Product

Post by Integral » Tue May 22, 2012 8:17 am

Hello everyone.
I read all the posts and tried all inputs, also i alread tried the samples, everything is ok. I also did a lot of tests and checked them, its all correct, bot still i get Wrong Answer.
Please someone help me, i dont want just to give up, but dont know what to do, here is my code:

Code: Select all

 removed after correction
Last edited by Integral on Sat May 26, 2012 9:55 am, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10106 - Product

Post by brianfry713 » Wed May 23, 2012 12:02 am

Try running your code with a newline after the last input.
Check input and AC output for thousands of problems on uDebug!

Integral
New poster
Posts: 5
Joined: Tue May 22, 2012 8:09 am

Re: 10106 - Product

Post by Integral » Wed May 23, 2012 2:49 am

you mean this?
Its strange cause after the last input my last output will be followed by a newline anyway. This way after the last output will be more 2 newlines, how can this help?
Last edited by Integral on Sat May 26, 2012 9:53 am, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10106 - Product

Post by brianfry713 » Wed May 23, 2012 11:13 pm

No, don't print two newlines at the end of the output, Try putting a newline or extra space after the last input value.
Check input and AC output for thousands of problems on uDebug!

Integral
New poster
Posts: 5
Joined: Tue May 22, 2012 8:09 am

Re: 10106 - Product

Post by Integral » Thu May 24, 2012 7:13 am

Could you say what you think or what you know ? Say what im doing wrong and why is wrong, please.
I dont see any reason to put more newlines.
Thx

Integral
New poster
Posts: 5
Joined: Tue May 22, 2012 8:09 am

Re: 10106 - Product

Post by Integral » Fri May 25, 2012 12:00 am

Anyway, i did what you said and im still getting wrong answer. Here goes my code

[code[/code]

Honestly, i dont have any idea what is causing the error, everything looks fine and works fine. I tested the samples, tested all cases in all posts here and more cases randomly. checked them all, RIGHT answer all the time.

Must be something...
Last edited by Integral on Sat May 26, 2012 9:53 am, edited 1 time in total.

Integral
New poster
Posts: 5
Joined: Tue May 22, 2012 8:09 am

Re: 10106 - Product

Post by Integral » Sat May 26, 2012 9:52 am

I solved my problem, its not a newline issue, but thanks for helping.

Post Reply

Return to “Volume 101 (10100-10199)”