11361 - Investigating Div-Sum Property
Moderator: Board moderators
11361 - Investigating Div-Sum Property
my code is giving correct output for first two sample but not for the third one.
is that output is correct?
need more test cases.
Title Edited by Moderator
is that output is correct?
need more test cases.
Title Edited by Moderator
Code: Select all
keep dreaming...
-
- Experienced poster
- Posts: 196
- Joined: Wed May 02, 2007 10:12 pm
- Location: Hungary, Pest county, Halasztelek
- Contact:
Re: 11361-- are there all correct outputs?
The sample input/output is good!apurba wrote:my code is giving correct output for first two sample but not for the third one.
is that output is correct?
need more test cases.
It's easier if you use unsigned int, because A and B can be as large as 2^31-1 to avoid overflow in int type. And perhaps a clever algorithm to avoid TLE, use a large precomputed hash table to avoid the big computation of the answer.
The tricky test cases are those where A or B is divisible by a large power of 10. (It's too easy to miscompute the bounds of some variables).
what wrong with my code?
here is my code.
what wrong with that?
anyone help.
what wrong with that?
Code: Select all
cut without ac
Last edited by apurba on Sun Nov 25, 2007 2:40 pm, edited 1 time in total.
Code: Select all
keep dreaming...
-
- Experienced poster
- Posts: 196
- Joined: Wed May 02, 2007 10:12 pm
- Location: Hungary, Pest county, Halasztelek
- Contact:
Re: what wrong with my code?
Your program is completely wrong. You have to compute the sum of the digits like this way:apurba wrote:here is my code.
what wrong with that?
Code: Select all
unsigned int sumofdigits( unsigned int n) {
unsigned int k=n,sum=0;
while(k) sum+=k%10,k/=10;
return sum;
}
Re: what wrong with my code?
Robert Gerbicz wrote:Your program is completely wrong. You have to compute the sum of the digits like this way:apurba wrote:here is my code.
what wrong with that?And try to avoid TLE, because by only this simple sumofdigits function you'll get that.Code: Select all
unsigned int sumofdigits( unsigned int n) { unsigned int k=n,sum=0; while(k) sum+=k%10,k/=10; return sum; }
this is not working!!!!!!!
wrong again.
Code: Select all
keep dreaming...
-
- Experienced poster
- Posts: 122
- Joined: Sun Nov 13, 2005 10:25 am
- Location: Taiwan
Hello, I tried to use DP (10*10*K*K) to solve these problem
but got WA
Can someone check the I/O below? thanks.
Input:
CORRECT output:
but got WA
Can someone check the I/O below? thanks.
Input:
Code: Select all
6
234 4567 8
3421 4568976 3
1232 456965 7
9909 123444 5
11111 11111111 7
980364 2147483647 11
Code: Select all
69
1521852
9306
4542
226548
17737396
Last edited by Wei-Ming Chen on Thu Jan 24, 2008 2:48 pm, edited 1 time in total.
You can check I/O on my page http://www.uvatoolkit.com.
Last edited by greve on Wed Oct 28, 2009 6:57 pm, edited 1 time in total.
For help with problems, visit http://www.uvatoolkit.com/