10925  Krakovia
Moderator: Board moderators
10925  Krakovia
Can you give me some testdata , I don't know where wrong in my code
thanks
thanks
tricky case
stupid mistake.
ignore it.
ignore it.
Last edited by wook on Sun Oct 02, 2005 5:00 am, edited 1 time in total.
Sorry For My Poor English..
sorry
i got very stupid mistake..
sorry again.
V < 10^20,
thus we can't use only 64bit integers.
and, the test cases I used to debug my program
input:
sorry again.
V < 10^20,
thus we can't use only 64bit integers.
and, the test cases I used to debug my program
input:
output:1 1
1
1 20
1
3 9
1
4
3
3 8
1
4
3
1 1
31415926535897932384
5 11
99999999999999999999
99999999999999999999
99999999999999999999
99999999999999999999
99999999999999999999
2 20
31415926535897932384
31415926535897932384
2 9
20000000000
1000
3 1
100000000000000000000
200000000000000000000
400000000000000000000
11 2
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
100000000000000000000
5 20
100000000000000000000
99999999999999999999
99999999999999999998
99999999999999999997
99999999999999999996
4 17
3515135187212
503540533457899
2132105
102
21 7
1
10
100
1000
10000
100000
1000000
10000000
100000000
1000000000
10000000000
100000000000
1000000000000
10000000000000
100000000000000
1000000000000000
10000000000000000
100000000000000000
1000000000000000000
10000000000000000000
100000000000000000000
0 0
Bill #1 costs 1: each friend should pay 1
Bill #2 costs 1: each friend should pay 0
Bill #3 costs 8: each friend should pay 0
Bill #4 costs 8: each friend should pay 1
Bill #5 costs 31415926535897932384: each friend should pay 31415926535897932384
Bill #6 costs 499999999999999999995: each friend should pay 45454545454545454545
Bill #7 costs 62831853071795864768: each friend should pay 3141592653589793238
Bill #8 costs 20000001000: each friend should pay 2222222333
Bill #9 costs 700000000000000000000: each friend should pay 700000000000000000000
Bill #10 costs 1100000000000000000000: each friend should pay 550000000000000000000
Bill #11 costs 499999999999999999990: each friend should pay 24999999999999999999
Bill #12 costs 507055670777318: each friend should pay 29826804163371
Bill #13 costs 111111111111111111111: each friend should pay 15873015873015873015
Sorry For My Poor English..
try these..
try this case
Input
Output
Input
Code: Select all
2 3
9999
1
1 20
3
4 5
9999
999
99
9
0 0
Code: Select all
Bill #1 costs 10000: each friend should pay 3333
Bill #2 costs 3: each friend should pay 0
Bill #3 costs 11106: each friend should pay 2221
Re: try these..
thanks very muchsohel wrote:try this case
InputOutputCode: Select all
2 3 9999 1 1 20 3 4 5 9999 999 99 9 0 0
Code: Select all
Bill #1 costs 10000: each friend should pay 3333 Bill #2 costs 3: each friend should pay 0 Bill #3 costs 11106: each friend should pay 2221
The reason is my "lazy bigint addition"
I don't code right addition , so got wa
I remember that I code lazy ( short code ) addition for speed
thanks sohel and wook again !
You can try this case :
1 1
56270
1 8
59532
11 4
46174
39274
57939
53253
62523
46232
49934
64389
60970
42991
46583
16 17
39008
59470
53737
39200
42326
40011
43117
53067
48817
47243
48956
50353
45630
62386
54306
62179
14 10
51959
49936
56012
41518
58226
60565
53840
46328
61011
50654
47690
48301
65452
43772
6 10
54850
55119
49470
48852
57800
60821
17 6
56305
54239
58889
54091
64035
51876
38340
65492
54206
63609
63493
58506
38590
55719
54342
60086
60088
5 5
44576
40948
40505
45189
52782
11 1
61926
52873
52155
49032
58536
62368
46146
47586
41034
41329
64354
12 11
48372
44217
58523
59537
59012
56261
49882
61864
48555
64678
39308
59656
0 0
1 1
56270
1 8
59532
11 4
46174
39274
57939
53253
62523
46232
49934
64389
60970
42991
46583
16 17
39008
59470
53737
39200
42326
40011
43117
53067
48817
47243
48956
50353
45630
62386
54306
62179
14 10
51959
49936
56012
41518
58226
60565
53840
46328
61011
50654
47690
48301
65452
43772
6 10
54850
55119
49470
48852
57800
60821
17 6
56305
54239
58889
54091
64035
51876
38340
65492
54206
63609
63493
58506
38590
55719
54342
60086
60088
5 5
44576
40948
40505
45189
52782
11 1
61926
52873
52155
49032
58536
62368
46146
47586
41034
41329
64354
12 11
48372
44217
58523
59537
59012
56261
49882
61864
48555
64678
39308
59656
0 0
Here is the output from my accepted program.
Bill #1 costs 56270: each friend should pay 56270
Bill #2 costs 59532: each friend should pay 7441
Bill #3 costs 570262: each friend should pay 142565
Bill #4 costs 789806: each friend should pay 46459
Bill #5 costs 735264: each friend should pay 73526
Bill #6 costs 326912: each friend should pay 32691
Bill #7 costs 951906: each friend should pay 158651
Bill #8 costs 224000: each friend should pay 44800
Bill #9 costs 577339: each friend should pay 577339
Bill #10 costs 649865: each friend should pay 59078
I hope you will get AC
Bill #1 costs 56270: each friend should pay 56270
Bill #2 costs 59532: each friend should pay 7441
Bill #3 costs 570262: each friend should pay 142565
Bill #4 costs 789806: each friend should pay 46459
Bill #5 costs 735264: each friend should pay 73526
Bill #6 costs 326912: each friend should pay 32691
Bill #7 costs 951906: each friend should pay 158651
Bill #8 costs 224000: each friend should pay 44800
Bill #9 costs 577339: each friend should pay 577339
Bill #10 costs 649865: each friend should pay 59078
I hope you will get AC
Hum.. i had accepted all sugestted inputs but I was still getting WA, so i found two inputs that showed me some extra cases. After correct this I got Accepted. Here they are:
Input:
Output:
Good Luck for everyone
Input:
Code: Select all
1 16
17432479801732498109834891047810
1 15
17432479801732498109834891047810
Code: Select all
Bill #1 costs 17432479801732498109834891047810: each friend should pay 1089529987608281131864680690488
Bill #2 costs 17432479801732498109834891047810: each friend should pay 1162165320115499873988992736520
UFCG Brazil  Computer Science graduate student
http://acm.uva.es/problemset/usersnew.php?user=54806 ... and going up!
http://acm.uva.es/problemset/usersnew.php?user=54806 ... and going up!

 Experienced poster
 Posts: 101
 Joined: Wed May 04, 2005 4:33 pm
 Location: Tangerang, Banten, Indonesia
 Contact:
10925  Krakovia
Somebody please help me, how to solve this problem? It's look like easy to solve but I failed with the second test case in sample input. Here's my code:
Any help would be appreciated...
Code: Select all
AC already
Last edited by Roby on Sun Apr 16, 2006 10:47 am, edited 1 time in total.

 Guru
 Posts: 584
 Joined: Thu Jun 19, 2003 3:48 am
 Location: Sanok, Poland
 Contact: