Page 5 of 5

### Re: Got WA at UVa 11371 - Number Theory for Newbies

Posted: Fri Sep 27, 2013 11:27 pm
brianfry713 wrote:Input 191, correct output:911 - 119 = 792 = 9 * 88
Each line of input gives a positive integer n (? 2000000000). You are to find two integers a and b formed by rearranging the digits of n, such that a-b is maximum.

In my AC output a - b = 792, with is greater than 720 in your WA output.

### Re: 11371 - Number Theory for Newbies

Posted: Sat May 03, 2014 7:20 pm

Code: Select all

``````removed after AC
``````

### Re: 11371 - Number Theory for Newbies

Posted: Sun May 04, 2014 1:35 am
That looks like AC code. However, if you submitted your code as ANSI C, note that the atoll function will not be available.

If you have access to a gcc compiler, try compiling your programs using the same flags used by the UVa server, which for ANSI C are: "-lm -lcrypt -O2 -pipe -ansi -DONLINE_JUDGE", and that'll help you catch this type of bugs.

### Re: 11371 - Number Theory for Newbies

Posted: Sun May 04, 2014 3:58 pm
That looks like AC code. However, if you submitted your code as ANSI C, note that the atoll function will not be available.
Thank you so much lbv.I didnt know atoll is not ANSI supported.Thanks for teaching me.I just manually built that function & got AC.Thanks again!!!

### Re: 11371 - Number Theory for Newbies

Posted: Tue Dec 23, 2014 12:33 pm
I am getting WA here. Though all the I/O given in problem and this discussion board have given correct answer.

Code: Select all

``````Removed after getting AC :)
``````

### Re: 11371 - Number Theory for Newbies

Posted: Tue Dec 23, 2014 2:30 pm
This line can give undefined results when you try to access value of a because your array is a[10].

Code: Select all

``for (int i = 1; i <= 10; i++)``
Change line to

Code: Select all

``for (int i = 1; i < 10; i++)``