Page 2 of 3

Posted: Fri Jul 29, 2005 11:19 pm
by mf
For the input n=9981, the expected output from your program is 9972.

Do you think a double type (with its mere 53 bits of precision) is able to _accurately_ handle numbers of order 10^9972?
Change the approach.

Posted: Mon Aug 01, 2005 1:48 pm
by Navid666
i changed my approach and got accept , you were right we do not need to work with numbers of one's, we can use mods ;):D

10127 sugestion

Posted: Wed Aug 24, 2005 12:45 am
by JackDaniels
Hi everybody.

Here is my suggestion:
-all types you need is int and double
-for solving here is some info:
You must compute the arithmetic mean (AM) for the spendings of the students. And there are 3 cases:
1. If the AM is something like ddd.005 then you must compute the minimum exchange sums for upper and lower spendings than ddd.000 first and for ddd.010 secondly. You choose the minimum from these two, but if one of the sums is zero then you choose the other one which might be greater than zero.
2. If the AM is something like ddd.qqq slower than ddd.005 then this calculus is done for ddd.000
3. Else if AM is like ddd.qqq larger than ddd.005 then the calculus is done for ddd.010. And there is okey.
Good luck.

So, someone showed some correct test cases:

Code: Select all

3 
10.00 
20.00 
30.00 
4 
15.00 
15.01 
3.00 
3.01 
5 
5000.00 
11.11 
11.11 
11.11 
11.11 
3 
0.01 
0.03 
0.03 
4 
25.00 
25.00 
25.00 
28.00 
3 
10.01 
15.25 
18.96 
4 
25.03 
25.00 
25.00 
25.00 
0 

the right answers are:
$10.00
$11.99
$3991.11
$0.01
$2.25
$4.73
$0.02
For the third test case i am in doubt that answer is correct so the solution provided by UVA judge is wrong. My answer is: 3991.08 and that is so because we can take the AM as 1008.880 firstly (and the answer is 3991.08 -this is the minimum exchange sum) and as 1008.890 secondly(for this the answer is 3991.11 -surely larger than previous one). The computed value for AM is initially 1008.888000 but I say it is correct to compute for both roundings and then choose the minimum.
I please UVA to correct this in the future!

Posted: Fri Sep 23, 2005 2:15 pm
by Carlos
you didn't understand the problem description. Try to make a "balance" and you'll find the mistake.

Judge's solution is ok.

Sample Input?

Posted: Sat Oct 29, 2005 5:45 am
by Kentaro
Can someone who has gotten AC offer some sample input? It is really hard to verify cases by hand for me but despite every test I throw at it working, I still get WA.

Also, what should the output be if the input number is 0, or divisible by 2 or 5?

EDIT: I rethought the main loop of my program and the exit condition was too weak, so for some numbers the output number was too large. I replaced it with the correct condition and got AC. Still, I think the I/O would be a service to others working on this problem... does anyone want any?

10127. Ones - WA -

Posted: Wed Apr 05, 2006 6:45 am
by mosaick2
I think my logic is right.
But, I got WA.
Actually, I can't understand what's wrong in my code?
Help me If you know what's trouble.

Code: Select all

#include <iostream>
using namespace std;

int main()
{
	int n;
	do {
		/* Input */
		cin >> n;
		/* Processing */
                < Skipped for person who is solving this problem >
                      
		/* Output*/
		cout << count << endl;
	}while(!cin.eof());

	return 0;
}

Posted: Wed Apr 05, 2006 3:51 pm
by mamun

Code: Select all

do{
   Input
   ...
   Output
}while(EOF);
Your code prints something unnecessary after reaching EOF.

Posted: Thu Apr 06, 2006 4:18 pm
by mosaick2
mamun wrote:

Code: Select all

do{
   Input
   ...
   Output
}while(EOF);
Your code prints something unnecessary after reaching EOF.
Thanks, mamun.
I got AC. : )

10127--need more sample I/O

Posted: Sun Apr 22, 2007 8:06 am
by ranacse05
Hi there plz give me some I/O of 10127

Posted: Sun Apr 22, 2007 10:23 am
by abdullah<cse du>
ranacse05,

Try this input
Input

Code: Select all

1
11
109
5241
9999
8521
9789
23
17
999
Output

Code: Select all

1
2
108
291
36
710
150
22
16
27
I think this will help you.
ABDULLAH

presentation error

Posted: Tue Jun 05, 2007 10:21 pm
by SARKAR
plzzzz help dunno y i m getting present error

Code: Select all

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int a;
while(scanf("%i",&a)!=EOF)
{
int l=1;
int k=1,no=1;
while(1)
{
int l=k%a;
if(l==0)
{
printf("%i \n",no);
break;
}
k=l*10+1;
no++;
}
}
}
 :cry: 

Posted: Wed Jun 06, 2007 10:00 am
by Jan
Use

Code: Select all

printf("%i\n",no);
Since you are printing one extra space at the end of every line.
Hope it helps.

Posted: Tue Jul 03, 2007 7:27 pm
by andmej
Here are some extra test cases:

Input:
3
7
9
11
13
17
19
21
23
27
29
31
33
37
39
41
43
47
49
51
53
57
59
61
63
67
69
71
73
77
79
81
83
87
89
91
93
97
99
1001
1003
1007
1009
1011
1013
1017
1019
1021
1023
1027
1029
1031
1033
1037
1039
1041
1043
1047
1049
1051
1053
1057
1059
1061
1063
1067
1069
1071
1073
1077
1079
1081
1083
1087
1089
1091
1093
1097
1099
1101
And my accepted program spits this:
3
6
9
2
6
16
18
6
22
27
28
15
6
3
6
5
21
46
42
48
13
18
58
60
18
33
66
35
8
6
13
81
41
84
44
6
15
96
18
6
464
234
252
336
253
1008
1018
1020
30
78
294
103
1032
240
519
519
444
348
524
1050
162
150
96
212
1062
96
1068
144
84
537
246
506
342
1086
198
1090
273
1096
78
366
It must be more than enough, I hope.

Posted: Thu Jul 19, 2007 12:04 pm
by newton
i am also interested to know?

neo_thohin
if you cant explaine about Bhagsash upopado
delete your post......









dont use any language [that is not english]..
good luck

Re: 10127 - Ones

Posted: Tue Sep 29, 2009 3:55 am
by wasifhossain
"Bhagsash upopado" means nothing but "Remainder Theorem"