10127  Ones
Moderator: Board moderators

 New poster
 Posts: 8
 Joined: Mon Aug 11, 2003 4:51 pm
 Location: Suceava, Romania
10127 sugestion
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:
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!
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
I please UVA to correct this in the future!
Nothing is lost because everything is transforming.
Sample Input?
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?
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?
Computer Science is no more about computers than Astronomy is about telescopes.
 E. W. Dijkstra
 E. W. Dijkstra
10127. Ones  WA 
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.
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;
}
Last edited by mosaick2 on Thu Apr 06, 2006 4:22 pm, edited 1 time in total.
Code: Select all
do{
Input
...
Output
}while(EOF);
Thanks, mamun.mamun wrote:Your code prints something unnecessary after reaching EOF.Code: Select all
do{ Input ... Output }while(EOF);
I got AC. : )

 New poster
 Posts: 39
 Joined: Mon Dec 04, 2006 2:18 pm
 Location: Bangladesh(CSE DU)
 Contact:
ranacse05,
Try this input
Input
Output
I think this will help you.
ABDULLAH
Try this input
Input
Code: Select all
1
11
109
5241
9999
8521
9789
23
17
999
Code: Select all
1
2
108
291
36
710
150
22
16
27
ABDULLAH
presentation error
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:
Use
Since you are printing one extra space at the end of every line.
Hope it helps.
Code: Select all
printf("%i\n",no);
Hope it helps.
Ami ekhono shopno dekhi...
HomePage
HomePage
Here are some extra test cases:
Input:
Input:
And my accepted program spits this: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
It must be more than enough, I hope.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
Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.
Are you dreaming right now?
http://www.dreamviews.com
Are you dreaming right now?
http://www.dreamviews.com

 New poster
 Posts: 3
 Joined: Tue Apr 28, 2009 7:26 pm
Re: 10127  Ones
"Bhagsash upopado" means nothing but "Remainder Theorem"
Who is online
Users browsing this forum: No registered users and 1 guest