QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#412361#8227. 圆Gordonlu0 234ms3756kbC++141.4kb2024-05-16 12:27:552024-05-16 12:27:55

Judging History

你现在查看的是最新测评结果

  • [2024-05-16 12:27:55]
  • 评测
  • 测评结果:0
  • 用时:234ms
  • 内存:3756kb
  • [2024-05-16 12:27:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n;
double a[1000005];
int ans=0;
int bin[10];
int main(){
	int t;
	cin>>t;
	while(t--){
		cin>>n;
		ans=0;
		for(int i=1;i<=n;i++){
			cin>>a[i];
			ans+=floor(a[i]);
			bin[int(10*(a[i]-floor(a[i]))+0.5)]++;
		}
		ans+=bin[5];
		ans+=bin[6];
		ans+=bin[7];
		ans+=bin[8];
		ans+=bin[9];
		int zs=0;
		zs=min(bin[4],bin[1]);
		ans+=zs;
		bin[4]-=zs,bin[1]-=zs;
		if(bin[1]){
			zs=min(bin[3],bin[2]);
			ans+=zs;
			bin[3]-=zs,bin[2]-=zs;
			zs=min(bin[3],bin[1]/2);
			ans+=zs;
			bin[3]-=zs,bin[1]-=zs*2;
			zs=bin[3]/2;
			ans+=zs;
			bin[3]-=zs*2;
			zs=min(bin[2]/2,bin[1]);
			ans+=zs;
			bin[2]-=zs*2,bin[1]-=zs;
			zs=min(bin[2],bin[1]/3);
			ans+=zs;
			bin[2]-=zs,bin[1]-=zs*3;
			zs=bin[2]/3;
			ans+=zs;
			bin[2]-=zs*3;
			zs=bin[1]/5;
			ans+=zs;
			bin[1]-=zs*5;
			
		}else{
			zs=min(bin[4],bin[2]);
			ans+=zs;
			bin[4]-=zs,bin[2]-=zs;
//			cout<<ans<<" "<<bin[2]<<endl; 
			zs=min(bin[3],bin[2]);
			ans+=zs;
			bin[3]-=zs,bin[2]-=zs;
//			cout<<ans<<" "<<bin[3]<<endl; 
			zs=min(bin[4],bin[3]);
			ans+=zs;
			bin[4]-=zs,bin[3]-=zs;
			zs=bin[4]/2;
			ans+=zs;
			bin[4]-=zs*2;
//			cout<<ans<<" "<<bin[3]<<endl; 
			zs=bin[3]/2;
			ans+=zs;
			bin[3]-=zs*2;
			zs=bin[2]/3;
			ans+=zs;
			bin[2]-=zs*3;
		}
		cout<<ans<<endl;
	} 
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 18ms
memory: 3628kb

input:

10000
5
0.3 1.3 7.5 0.9 1.3
5
3.7 2.8 4.8 3.3 6.8
5
5.9 5.5 0.9 8.8 6.0
5
6.9 1.9 8.3 0.9 8.6
5
1.1 5.2 5.1 6.1 7.1
5
5.1 5.8 6.1 0.1 5.2
5
1.3 7.1 3.1 2.9 9.6
5
7.8 9.8 6.8 0.8 7.8
5
6.3 9.8 1.1 3.4 7.1
5
0.1 1.7 1.2 2.2 3.7
5
3.7 9.5 0.2 8.7 7.2
5
0.0 3.6 2.7 5.1 9.9
5
5.8 3.0 5.0 4.0 8.3
5
1.0 9....

output:

12
25
34
37
39
37
40
51
51
33
56
50
58
58
59
61
71
57
60
71
71
69
67
84
71
74
80
80
92
84
81
91
101
94
102
82
105
115
99
107
101
124
112
115
122
121
126
135
132
136
134
144
122
152
137
151
155
160
156
160
166
170
165
172
162
181
163
184
188
187
194
179
195
183
203
195
208
210
207
210
226
218
214
225...

result:

wrong answer 2nd numbers differ - expected: '22', found: '25'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 1ms
memory: 3620kb

input:

100
12
3.8 2.2 7.7 4.3 8.1 9.3 6.2 7.6 5.8 9.3 5.3 7.2
12
9.1 5.5 6.5 8.1 4.1 4.5 9.1 0.5 3.1 3.7 6.5 2.4
12
2.4 3.4 3.4 8.7 0.7 9.2 0.9 2.0 5.0 8.6 5.0 0.0
12
6.7 5.0 4.7 8.9 8.5 2.8 9.0 6.8 6.0 6.7 9.5 0.9
12
4.2 7.2 8.5 9.1 0.2 4.2 0.2 5.6 2.3 1.7 0.2 8.4
12
9.7 6.8 4.0 1.8 7.7 2.8 2.1 3.3 0.7 4....

output:

79
71
62
92
78
82
106
97
114
123
108
123
152
133
145
142
119
163
159
154
158
167
157
190
189
207
177
201
210
218
222
250
229
233
231
245
255
239
269
252
280
291
313
309
298
320
340
321
306
334
351
345
336
343
362
361
363
369
391
375
402
398
388
431
416
422
431
437
427
457
440
448
464
457
468
500
510...

result:

wrong answer 2nd numbers differ - expected: '66', found: '71'

Subtask #3:

score: 0
Wrong Answer

Test #15:

score: 0
Wrong Answer
time: 191ms
memory: 3740kb

input:

10000
80
5.8 9.4 8.7 6.3 3.9 8.7 1.6 3.3 1.6 7.2 3.8 1.8 4.7 7.3 4.8 2.1 1.2 6.5 0.9 1.8 2.6 2.8 7.1 0.9 9.5 4.5 0.8 1.9 3.6 5.9 9.8 3.3 3.8 6.8 4.7 0.0 6.6 9.9 8.8 9.3 7.2 5.9 1.9 8.8 0.6 0.3 4.2 1.3 2.2 8.2 4.8 2.9 4.7 6.2 1.7 7.2 1.0 8.0 9.9 6.2 7.3 8.8 3.6 4.6 0.7 9.6 9.3 8.2 7.6 6.8 5.2 3.6 7.8...

output:

425
479
453
540
546
600
576
666
727
697
731
751
768
834
881
939
937
978
1041
1019
1098
1166
1195
1175
1227
1290
1302
1404
1430
1517
1507
1519
1553
1635
1699
1740
1790
1835
1828
1938
2007
2023
2027
2079
2148
2192
2181
2269
2300
2279
2374
2418
2461
2535
2578
2557
2640
2692
2737
2770
2802
2847
2815
289...

result:

wrong answer 2nd numbers differ - expected: '429', found: '479'

Subtask #4:

score: 0
Wrong Answer

Test #22:

score: 0
Wrong Answer
time: 222ms
memory: 3756kb

input:

10000
100
9.0 7.4 3.6 2.0 6.4 8.4 3.4 2.4 9.4 2.6 8.6 3.4 4.4 8.4 5.4 6.4 3.4 8.6 0.0 1.0 8.4 8.0 6.6 6.6 5.4 8.4 7.0 2.6 9.6 1.6 8.6 0.8 5.0 8.4 8.4 7.4 3.8 6.4 9.4 2.6 8.4 9.6 3.0 3.4 6.4 8.4 6.4 8.4 5.4 4.4 4.6 1.4 7.4 7.4 5.8 4.0 6.6 0.4 7.4 1.8 5.4 9.4 9.4 3.0 1.6 4.8 5.0 3.4 0.4 1.0 2.0 4.4 3....

output:

543
530
580
601
608
695
706
721
749
877
874
884
891
1008
1051
1056
1086
1037
1158
1208
1275
1266
1319
1276
1331
1342
1424
1421
1432
1505
1519
1499
1596
1663
1719
1785
1724
1818
1895
1858
1991
1958
2007
2052
2130
2177
2265
2271
2343
2356
2393
2418
2481
2504
2541
2502
2557
2629
2620
2727
2695
2765
287...

result:

wrong answer 2nd numbers differ - expected: '503', found: '530'

Subtask #5:

score: 0
Wrong Answer

Test #29:

score: 0
Wrong Answer
time: 234ms
memory: 3592kb

input:

10000
100
2.1 3.8 5.3 2.1 1.8 3.1 5.6 6.8 1.3 8.6 5.8 1.9 4.9 4.2 9.2 6.1 6.3 2.2 5.6 1.3 6.7 2.7 1.0 6.8 6.3 5.9 8.3 7.9 0.0 0.1 4.9 4.9 0.2 2.9 4.0 8.6 1.6 2.0 1.0 1.0 5.7 2.0 5.7 2.8 2.8 2.8 2.3 5.9 5.3 7.0 8.6 4.0 6.6 5.1 5.0 8.7 3.0 0.9 5.0 2.8 4.7 5.1 1.2 8.1 0.0 0.6 6.6 1.3 3.0 0.6 9.9 9.0 9....

output:

459
578
655
690
767
818
898
944
968
1040
1091
1163
1203
1261
1326
1384
1425
1469
1536
1586
1655
1694
1767
1815
1822
1880
1919
1971
2066
2119
2167
2137
2237
2309
2340
2371
2548
2568
2642
2701
2719
2778
2787
2896
2912
2981
3018
3085
3080
3186
3190
3177
3222
3241
3276
3341
3430
3497
3560
3577
3608
3754...

result:

wrong answer 2nd numbers differ - expected: '529', found: '578'