Page 1 of 3

### 10014 - Simple calculations

Posted: Thu Aug 08, 2002 4:26 pm
I don't know what's wrong ?
This is my source:
[cpp]
#include <iostream.h>
#include <stdio.h>

#define MAX_EL 3335

int n;
double a0, an1;
double c[MAX_EL];
double tmp;

int main() {

while(scanf("%d", &n) != EOF) {
cin >> a0;
cin >> an1;
tmp = 0.0;
for(int i=0; i<n; i++) {
cin >> c;
}
a0 *= n/(n+1.0);
a0 += an1/(n+1.0);
for(int i=1; i<=n; i++) tmp += ((2.0 * i) / (n + 1.0)) * c[n-i];
printf("%.2f\n", a0 - tmp);
}
return 0;
}
[/cpp]

Posted: Thu Aug 08, 2002 8:01 pm
That's easy. The firstt number in input is the the number of test. Then follow tests. For example(This is judge input):

Code: Select all

``````6

1
50.50
25.50
10.15

3
-178.10
-76.60
448.80
-913.85
328.85

4
-853.00
752.00
-941.20
191.75
-428.00
534.30

100
-742.90
447.10
-60.35
-403.85
-406.65
641.80
-365.80
-444.05
999.30
-435.00
13.60
-244.05
934.60
-973.65
-206.55
753.80
89.60
-1009.40
1354.75
-751.20
-74.05
-411.45
1474.35
-1270.65
-86.95
304.40
256.85
135.95
-156.20
-446.95
20.00
1290.50
-1021.55
-603.55
885.00
-160.40
-234.10
153.55
-182.85
465.20
-106.35
-351.20
-128.75
110.30
415.80
-148.70
390.05
-1030.05
708.80
-343.95
905.95
-1002.70
6.30
553.65
-504.95
677.55
-739.50
-56.85
334.05
815.55
-916.90
-166.80
212.80
88.30
514.30
-1314.95
746.55
116.00
368.70
-853.85
1043.60
-1203.90
910.50
-576.15
575.80
-346.35
-393.75
1050.95
-999.35
-41.65
706.00
-210.25
-311.45
355.95
402.70
-571.65
-297.40
765.30
-680.75
217.60
-19.95
292.25
-926.20
697.90
469.10
-1092.20
673.35
667.15
-1032.55
-357.65
1485.95
-960.95

999
873.20
-148.30
80.95
-48.35
886.30
-971.45
-84.00
397.05
-175.40
1072.90
-1112.55
-76.30
411.90
-170.20
6.00
361.90
-311.95
-69.50
-402.00
1182.35
-795.40
130.85
-578.95
1076.55
-1068.70
836.20
-703.45
116.45
1050.50
-917.60
6.90
240.95
-604.40
716.65
208.50
-1177.50
1276.05
-465.00
110.90
-940.70
1447.05
-879.95
-329.80
948.30
-33.35
-866.55
1049.65
-1415.30
1694.95
-1189.35
96.10
538.30
-815.10
409.55
579.05
-937.55
710.30
362.10
-1050.45
875.15
-810.40
877.70
-638.80
274.25
-255.40
-248.00
709.45
-674.70
654.80
-873.30
434.70
881.55
-1550.90
954.05
-158.70
181.00
-111.40
-85.75
-317.05
769.65
-407.30
-466.20
763.45
-494.00
51.30
260.95
302.55
-609.15
-217.95
240.40
817.95
-1022.35
374.55
-456.00
272.65
1108.70
-1821.35
1602.05
-761.85
-268.35
379.90
-409.35
822.95
-458.05
-781.15
1518.65
-882.30
205.35
-902.00
771.80
903.50
-1092.45
331.95
-143.85
-620.60
981.50
-713.15
1096.65
-1347.75
364.85
659.65
39.55
-1256.00
1632.50
-1349.45
305.60
864.25
-640.05
-226.45
648.00
-301.40
-436.70
58.70
-36.20
461.45
-32.00
395.05
-992.75
466.00
-144.40
764.30
-1443.85
959.50
238.20
-885.75
783.35
-27.05
112.00
-376.70
-420.65
938.10
-462.65
-892.95
1577.90
-1180.90
299.05
312.30
-362.70
509.15
-107.10
-144.35
-479.35
245.25
591.45
-451.40
533.65
-1214.60
1337.40
-1133.10
862.55
103.35
-784.40
307.90
366.30
-650.95
252.25
390.35
-428.65
-176.10
293.30
43.50
-379.40
721.35
-289.20
137.70
-1075.95
1385.05
-313.95
-94.95
-736.45
830.30
-177.05
1.15
100.65
-717.55
837.65
-42.75
-162.95
-519.60
78.05
772.50
-221.35
-503.75
619.25
-601.40
552.10
-179.80
-310.35
-138.35
726.15
-539.05
172.40
779.65
-1617.00
812.05
938.05
-984.50
-604.10
1033.95
-247.40
223.40
-840.90
700.85
-484.80
1036.20
-1481.00
1464.40
-1426.40
641.80
661.00
-517.85
-132.40
-499.05
698.40
361.50
-349.05
-1044.05
1713.35
-1629.00
1540.50
-1520.45
1003.35
-336.25
645.45
-685.40
277.95
271.15
-478.15
-745.95
1561.90
-1392.35
707.50
312.50
-451.65
243.80
-415.00
1036.95
-843.45
-304.50
320.55
209.70
43.05
-24.10
-366.15
-309.40
815.40
-333.80
144.10
150.30
-300.45
-750.70
1045.45
-555.15
408.90
461.55
-1140.75
1380.00
-1031.50
408.80
-985.15
1616.90
-1759.05
1197.25
10.10
-532.85
906.10
-1167.80
897.50
-670.35
644.15
-870.05
849.90
-481.35
269.90
-602.40
554.30
230.15
-426.70
626.55
-816.75
401.30
-389.65
953.15
-1305.40
1208.85
-801.30
133.80
209.75
-40.90
-633.90
785.70
219.75
-881.90
500.65
145.35
-630.95
1232.15
-1042.85
88.90
568.05
-509.55
-137.40
172.00
183.50
-324.20
878.65
-1567.35
1056.90
258.45
-335.10
-289.95
101.85
379.15
-204.95
231.05
-772.05
472.75
-121.25
209.35
343.95
-716.15
632.90
-787.40
189.60
20.65
660.00
43.15
-1256.30
1402.55
-1324.20
887.10
-38.10
345.30
-1057.05
476.10
592.45
-961.25
656.65
16.25
-180.45
164.15
-966.20
1632.85
-1515.50
1003.40
-146.35
-919.30
635.85
187.75
204.55
-532.05
158.25
836.60
-818.65
-250.35
226.85
-161.05
286.80
-267.05
342.55
23.40
286.55
-649.90
-305.85
970.55
-734.05
-53.60
598.55
214.55
-358.95
-665.50
769.50
-414.15
-126.75
362.45
164.40
-555.45
635.45
-250.00
158.70
-444.90
182.10
-61.25
798.90
-649.85
-326.80
707.80
-1115.80
1336.05
-800.00
306.25
-375.20
389.55
-735.65
850.50
-369.95
692.50
-537.75
-262.55
-26.95
61.20
118.55
-177.45
1084.90
-1587.75
626.75
115.05
226.25
121.90
-759.65
737.30
-713.45
1025.65
-932.40
-99.10
662.55
-193.40
20.80
-352.65
-35.55
526.25
467.25
-895.00
299.55
-954.15
1333.50
11.70
-1115.05
1087.15
-587.05
253.25
-262.45
-314.35
626.70
166.05
-806.45
781.65
-1012.10
1357.55
-996.20
705.65
-982.25
790.55
-240.40
300.95
-633.55
883.80
-604.20
438.45
-613.80
378.85
-479.50
672.60
-592.25
720.60
-674.30
-212.75
468.85
706.60
-1176.15
980.80
-751.05
148.20
163.40
-554.40
952.35
-699.20
772.50
-916.45
-100.45
807.00
80.70
-884.00
567.15
-92.20
-431.65
1331.80
-1165.30
-332.95
894.75
-271.80
181.40
-37.05
-145.10
-710.70
589.00
-4.50
912.10
-1341.35
894.95
-941.70
1062.10
-550.40
350.90
-673.35
772.25
-1051.65
1132.65
-588.00
-249.65
955.80
-444.70
-569.85
291.45
522.15
-261.45
-662.90
952.70
-680.15
478.10
-720.55
306.25
408.25
68.65
-289.85
-479.60
1139.60
-1169.90
1020.80
-481.85
-45.10
86.45
-560.35
465.15
819.45
-1650.05
942.80
335.50
-948.70
1454.85
-1064.70
-695.65
1287.60
-601.50
443.45
-280.20
344.75
-368.80
-423.50
403.10
-284.20
552.70
0.45
26.80
-539.15
-39.80
180.90
319.70
237.40
-801.00
138.95
852.20
-778.90
-232.05
473.80
148.10
-333.20
126.65
401.00
-1125.10
861.70
455.95
-443.70
-137.70
-782.55
1122.50
-685.80
699.50
-746.55
594.90
-626.15
659.80
221.00
-435.60
-640.50
702.55
118.65
17.75
-814.00
305.70
846.30
-985.90
941.25
-1126.05
1251.90
-1086.10
34.00
476.05
-182.20
811.90
-644.25
-338.60
-262.55
923.10
-789.55
1101.85
-866.00
-329.15
758.65
-184.90
167.90
-770.70
727.45
-287.10
-213.20
1268.65
-1864.15
1230.25
-135.95
-346.40
-214.20
780.90
-519.80
-156.30
269.85
-208.30
92.65
748.95
-756.90
64.40
348.50
-213.10
-289.10
216.90
-714.40
893.30
83.40
-48.90
-324.20
236.55
-255.90
-99.85
258.40
-616.20
885.30
-197.35
-385.75
671.65
-641.35
-243.65
1429.35
-1470.00
290.80
298.35
-97.70
506.35
-783.60
64.80
38.05
747.70
-525.70
-221.75
585.10
-317.85
-378.80
312.65
363.65
-346.15
-389.30
587.35
-268.20
-736.80
1487.00
-961.25
-55.25
1158.10
-1654.55
1419.40
-845.75
29.45
307.20
-322.70
797.10
-441.20
-738.25
660.50
126.65
70.35
-877.40
1402.20
-1367.05
635.00
350.30
-267.10
-895.90
1378.50
-509.35
-29.70
-920.85
741.60
477.85
-561.35
440.35
-555.85
454.35
-435.20
896.85
-1097.95
855.70
-696.60
1108.25
-1152.55
511.00
-360.35
199.65
-97.70
508.85
-1079.55
1416.70
-1145.90
580.10
-236.85
-327.85
385.30
744.45
-706.35
-268.85
7.15
-26.40
461.25
-210.65
-56.10
620.35
-817.40
190.40
722.55
-636.95
-937.65
1034.65
214.80
-585.45
444.65
427.45
-1118.20
749.20
-460.25
119.35
-27.40
93.15
380.25
-713.45
425.60
431.25
-643.85
200.75
223.25
-220.15
75.50
-457.25
-51.30
974.30
-692.85
101.70
297.75
-776.05
746.65
-379.30
292.05
-820.50
1365.35
-1471.80
946.25
269.65
-916.35
312.95
138.15
51.25
524.00
-711.10
431.65
-675.05
593.20
-500.70
603.75
-232.55
-359.80
514.00
-376.80
-170.60
-56.05
864.85
-166.00
-352.60
-720.75
873.65
90.25
-276.10
309.15
-380.50
-404.10
1120.65
-441.90
-203.00
196.05
-80.65
-289.65
215.95
-127.45
-303.70
989.15
-309.70
-808.05
764.50
-638.00
1068.80
-543.30
-69.45
-675.30
1156.15
-689.80
515.95
-985.65
1273.80
-456.10
-603.10
399.00
212.75
-141.50
-194.00
297.40
325.75
-672.65
-346.30
974.00
-488.65
313.70
111.45
-934.65
837.40
-409.05
213.50
-418.25
556.20
415.00
-777.05
-260.75
258.95
302.55
512.30
-631.60
-77.35
258.45
-287.00
-348.50
595.85
209.25
-1122.90
938.10
476.25
-610.25
-594.40
389.25
128.15
429.85
-505.10
197.50
-408.90
898.85
-1155.90
1138.50
-871.00
48.70
382.55
197.90
-630.80
513.40
-239.70
27.60
583.25
-1289.85
1354.55
-1019.80
858.20
-1307.20
1543.25
-529.15
-92.95
-788.75
992.00
-581.80
271.55
720.85
-1291.50
512.35
665.25
-903.15
611.20
-937.45
1206.10
-1198.90
1365.20
-829.55
291.30
-747.70
1232.40
-1015.60
-138.70
1149.20
-1312.60
779.90
-194.55
497.30
-450.70
-380.80
257.70
87.75
380.00
-662.35
533.50
180.30
-103.50
-389.65
-543.75
1139.10
-850.05
844.60
-1174.10
771.55
219.45
-347.15
-223.60
1119.95
-826.80
-348.95
-224.10
1457.10
-957.45
-662.35
1015.25
-765.65
564.55
799.00
-1060.85
-267.15
437.90
-5.60
-333.85
1168.00
-1153.90
367.15
51.45
-2.45
-5.45
-463.85
137.70
181.65
415.50
-186.25
-251.50
147.40
-213.45
302.60
-28.15
-794.80
1015.65
-679.25
283.75
169.40
342.10
-1095.95
1063.35
-68.90
-797.45
137.60
247.80
734.80
-1387.25
1064.60
-121.50
-91.85
-185.40
-75.45
-712.90
1793.65
-1059.40
-532.80
673.20
-364.50
441.05
97.25
-178.10

2999
39.90
-801.70
-835.60
869.25
-1026.25
965.45
-899.00
822.40
-548.85
705.15
-450.95
-268.20
-47.45
32.30
519.25
427.75
-1482.25
1578.35
-1662.20
1381.00
-301.65
-900.85
762.20
283.25
-536.10
-0.15
614.35
-794.15
997.25
-683.65
-323.70
1088.05
-868.50
-104.15
604.50
-697.50
175.95
534.45
-391.50
47.05
-113.85
-185.20
644.25
-681.05
319.75
398.40
-124.50
-786.95
337.15
521.00
148.30
-700.40
491.00
-559.65
232.90
-168.55
55.55
588.15
-420.15
-472.85
948.70
-825.75
343.10
683.85
-707.05
-6.30
-581.95
1367.60
-1632.60
1188.55
244.75
-568.00
-299.60
711.50
-872.05
114.00
1054.20
-758.20
-178.80
-39.45
1047.25
-693.20
-871.75
829.60
170.05
354.10
-731.05
-277.50
939.50
-470.85
-239.20
192.00
-53.60
-97.25
567.05
-918.90
539.30
906.25
-1740.75
1336.55
-1095.10
715.00
-54.35
654.70
-717.25
-661.40
716.75
-299.05
1075.95
-837.95
-645.80
660.90
599.05
-1308.35
1056.50
-132.10
-782.05
1252.40
-1069.00
259.05
629.65
-609.20
-0.70
-590.55
1034.70
-272.95
-528.80
894.60
-53.20
-985.15
1032.00
-269.25
-603.85
150.85
896.40
-1356.60
1271.50
-110.50
-622.30
-86.30
554.80
8.80
-277.35
-445.80
193.80
681.20
-1037.10
560.60
367.00
-202.50
-470.50
993.90
-1110.30
991.50
-613.00
-361.60
509.10
121.15
-571.40
990.05
-1158.45
949.75
-108.75
-678.50
698.45
-216.75
-467.10
575.20
-444.15
807.35
-672.45
-163.80
910.80
-1118.40
424.65
130.65
282.40
-468.10
126.00
304.65
-400.35
-98.60
-374.85
729.85
-267.15
400.10
265.45
-1412.05
914.30
-190.10
1062.25
-1517.30
799.40
-407.60
240.90
130.15
-80.35
149.05
-459.55
-121.60
273.95
-214.05
1032.80
-1197.45
813.85
-870.00
1208.25
-869.45
-433.65
749.05
75.60
-253.80
148.40
-273.90
28.55
519.45
-576.80
-65.45
226.80
216.90
45.30
-232.15
-754.60
737.30
647.00
-926.75
735.40
-571.45
-583.25
1035.55
-145.40
-769.50
814.80
-231.70
210.55
-603.35
1183.85
-1646.30
1071.50
-456.00
996.55
-911.15
-408.95
781.70
-504.40
683.85
-200.10
-334.10
474.20
-836.80
1112.70
-1265.40
946.60
-780.10
1100.65
-630.35
-539.55
773.15
278.90
-1261.90
797.10
480.05
-339.00
-440.90
-182.95
947.80
-1172.20
1452.15
-809.15
-597.75
1262.35
-1388.50
774.35
556.85
-298.60
-442.15
373.75
-563.25
250.05
-278.55
649.65
-95.65
15.25
-400.50
-86.15
640.00
1.65
-755.35
565.55
-676.65
1025.75
-1169.85
918.45
-230.65
395.10
-957.75
1169.05
-1231.85
1100.65
-946.15
254.35
375.45
278.85
-177.00
-649.05
409.25
-314.05
470.95
-234.70
-103.15
-60.50
488.80
-36.75
-773.10
275.55
521.00
-508.55
753.40
-429.10
-522.15
538.65
-395.70
380.50
725.95
-1111.75
440.75
-257.50
107.35
9.95
-77.85
-503.35
535.05
44.60
622.65
-1130.65
918.70
-572.45
151.50
74.15
167.75
-97.55
-773.75
678.80
21.15
-321.55
448.45
-513.85
457.95
474.40
-465.45
-318.30
-565.95
1206.15
-253.00
-2.80
-302.55
63.55
-718.65
1638.70
-1567.60
728.05
353.50
-267.85
-520.00
481.55
-256.20
31.20
-110.65
954.85
-1459.95
1645.15
-1455.50
267.80
837.00
-471.45
-379.20
309.15
137.95
-511.60
619.25
-92.20
-792.05
1456.90
-1271.15
644.00
-867.45
779.90
266.00
52.05
-671.95
269.45
-55.10
-37.70
255.50
-225.90
-277.45
-264.90
588.05
13.20
-25.35
134.55
580.15
-1571.50
1747.60
-1406.15
391.45
-200.95
840.70
-381.05
113.45
-625.90
464.20
86.35
-751.80
1269.90
-772.75
178.40
-608.55
883.35
-796.90
711.00
-131.90
-929.80
822.70
601.05
-928.30
-160.80
1346.80
-1775.00
1255.40
-687.00
664.90
-582.10
527.85
-296.75
173.85
-137.35
-198.35
51.05
-516.35
621.35
443.35
-514.60
-298.60
555.05
379.85
-1256.15
1044.35
-614.30
404.60
-288.25
529.90
-851.80
438.65
726.15
-1506.20
783.15
495.15
-605.75
-313.10
621.20
95.20
-321.10
-299.40
505.45
-110.70
-1.30
469.45
-692.90
229.50
-904.85
1601.95
-1419.50
1446.10
-1586.30
1289.90
-890.95
577.80
-249.00
545.95
-908.20
303.00
919.20
-1481.50
720.40
-173.10
173.30
635.35
-1102.45
469.25
156.20
-673.60
843.90
-292.70
108.45
71.80
-650.95
420.00
94.20
-468.85
409.25
87.30
-8.35
-501.05
1009.40
-1309.75
1000.80
-560.95
792.75
-933.50
415.15
346.80
-627.05
467.50
-589.75
689.70
35.70
-930.20
596.95
175.60
-417.55
187.50
91.75
99.45
62.90
-58.90
-1149.70
1018.60
149.45
126.00
19.15
-494.90
-98.10
36.95
51.40
726.80
-327.55
-1006.30
1338.65
-392.50
-98.35
-679.60
1108.95
-687.50
555.20
-470.95
338.90
-1184.40
1951.00
-1545.50
432.80
292.05
-273.30
93.30
417.55
-909.55
697.70
-103.65
-597.80
1031.45
-642.05
263.20
52.70
-212.05
-232.90
-9.10
834.65
-911.20
582.70
-575.10
-230.55
1504.05
-1019.65
64.30
-544.20
557.75
215.10
-631.65
1109.55
-1082.70
574.15
-481.90
366.15
-587.30
1468.80
-1120.05
-399.25
632.70
418.80
-1077.30
512.00
850.65
-1324.25
337.20
724.20
-973.60
237.35
1110.85
-1847.60
1637.15
-995.80
302.50
-115.75
88.20
823.70
-1727.15
1328.35
-551.70
178.55
116.25
376.60
-733.60
262.35
47.60
-666.90
1214.60
-802.00
490.55
-642.15
310.70
146.00
-380.70
178.25
466.25
-946.05
1104.05
-1186.90
1116.45
-1204.65
809.25
64.55
-324.95
450.35
194.70
-474.65
-431.45
476.95
170.25
-149.95
-400.85
521.75
153.55
-955.40
384.20
623.00
80.35
-481.50
-373.65
552.30
118.85
-344.25
-41.80
48.95
-163.55
-351.50
1118.55
-306.25
-430.25
348.30
-794.85
1173.00
-251.80
-1117.85
754.85
685.05
-1080.00
784.10
-595.70
234.75
231.65
-606.35
875.45
-429.00
111.25
-732.70
1042.55
-486.40
-96.65
358.20
-174.80
-579.20
1207.85
-1288.65
659.20
547.80
-1326.65
1421.00
-702.10
46.30
-10.10
-390.55
688.50
-646.60
839.40
-834.45
679.65
-1278.10
1546.30
-997.00
304.10
642.10
-818.50
582.25
-607.45
-97.55
870.15
-550.85
-737.15
1041.50
53.55
-461.95
238.75
-58.00
-548.60
990.95
-252.05
-687.55
479.55
243.90
-255.65
-187.10
-129.65
1125.70
-786.65
-431.65
245.60
725.20
-498.20
-175.35
-607.45
773.05
227.35
-505.95
-5.85
288.95
515.70
-657.95
-438.65
1244.55
-683.70
-435.70
318.30
-7.00
545.20
-495.45
-207.60
212.10
-192.05
262.65
-145.00
115.20
448.05
-1055.40
967.20
-323.55
-324.00
300.45
378.35
-377.95
-475.70
506.70
26.70
-63.30
382.75
-1164.65
894.50
636.65
-1139.65
-33.95
565.30
-442.10
724.60
-310.90
-265.20
-91.05
671.95
-252.85
-575.60
341.15
-326.50
568.60
-351.10
282.95
-350.50
642.45
-713.75
290.95
222.75
282.45
-1099.95
1166.10
-700.15
-467.95
1267.20
-1414.55
1229.45
-1039.15
1357.05
-1001.25
291.20
-899.15
1513.00
-1456.55
1259.15
-726.30
589.60
-278.45
-203.00
-441.55
790.65
-405.15
428.65
-350.00
-38.75
245.00
-161.20
357.95
-916.90
1248.40
-749.45
-503.55
722.55
-81.55
630.95
-1085.80
182.65
60.90
476.50
-584.45
1106.45
-1002.00
-76.10
322.30
285.55
-394.70
-58.45
-574.80
1420.45
-883.95
347.70
-922.70
584.65
440.20
-592.80
176.85
141.40
749.50
-1243.60
791.95
-1136.15
1078.30
405.40
-825.10
8.35
-310.80
570.75
-83.30
91.10
-44.75
82.65
-1005.45
1117.25
-492.55
123.60
456.70
13.55
-602.05
43.30
501.00
-985.70
1028.15
2.00
-307.85
-250.30
-406.00
1193.05
-930.75
788.90
-1205.20
1391.95
-1103.95
384.15
559.80
-415.85
-199.70
169.20
-460.85
421.60
53.55
-438.90
1109.95
-742.95
-257.45
614.05
-349.70
-494.45
580.30
77.90
-174.40
85.60
109.00
-592.05
643.40
-312.25
41.75
479.10
-977.15
620.60
496.60
-1246.20
628.45
-13.70
-129.10
650.15
-277.75
-66.90
-895.00
867.45
-221.35
736.45
-911.75
410.80
-382.80
458.50
-45.45
71.55
-200.50
-65.20
19.35
109.55
42.45
-159.70
106.15
-111.30
-602.55
582.45
1014.70
-1783.50
943.55
-226.55
879.40
-864.80
-251.15
29.40
1167.90
-1082.30
-155.15
848.70
-928.50
1015.05
-1031.50
318.00
1034.25
-1291.10
818.40
-603.80
175.50
214.35
-421.95
526.75
-650.15
-10.75
453.05
328.55
-399.90
-6.30
-24.35
113.95
-250.00
654.65
-1176.70
985.60
-112.65
-717.05
903.75
-738.25
488.25
-307.65
456.95
-22.35
-67.90
-225.70
-81.05
218.95
155.70
-226.65
-694.40
1028.90
-799.60
1016.90
-1140.85
646.65
397.90
-1152.05
711.55
822.10
-1051.85
-489.90
1313.50
-1039.85
635.75
-262.30
378.20
-1158.55
1440.15
-1203.35
1091.55
-326.90
-216.70
-269.85
337.85
216.25
-830.60
557.05
690.75
-1257.85
965.75
-827.05
920.25
-433.95
73.80
-295.80
-234.45
909.65
-760.00
66.35
722.20
-157.50
-1242.35
1474.80
-403.05
-951.55
1311.10
-341.70
-424.20
174.35
-291.70
525.60
-439.75
504.00
253.75
-962.85
516.80
-288.85
515.45
25.80
-405.60
-559.90
1228.45
-1274.25
754.60
465.95
-908.75
750.20
-329.30
181.20
-798.10
1275.40
-1360.40
1160.75
-1113.65
1175.05
-738.80
556.65
-335.25
-139.90
-367.50
1068.60
-888.90
570.00
-1192.30
1244.60
-648.70
868.60
-726.45
-141.65
953.30
-907.85
190.55
115.60
-42.50
499.90
-849.65
438.15
-202.95
-119.80
197.35
576.10
-1139.85
1356.10
-1132.40
798.85
-558.75
148.15
-8.25
-87.25
-164.95
36.50
15.00
858.35
-681.20
279.05
-418.10
-364.60
776.60
-268.85
136.50
-694.85
714.85
-81.50
289.45
-178.35
-583.70
814.25
-300.90
-558.60
986.40
-931.60
218.65
460.10
40.45
-560.65
60.75
28.00
780.00
-819.00
-275.65
794.25
210.60
-868.95
440.30
127.40
-748.80
252.45
881.00
-1333.60
1481.20
-619.95
-114.20
-52.75
-717.15
916.80
-47.90
-139.35
118.50
237.15
-757.35
684.60
-295.60
-460.55
857.65
-551.90
-180.50
905.60
-876.65
369.85
510.00
-689.30
-355.55
1128.85
-569.35
-663.40
875.10
-290.15
78.15
339.90
-1046.75
577.60
666.20
-1178.45
550.20
-68.40
389.35
-250.45
488.55
-1214.40
828.10
-413.55
872.90
-372.90
-754.35
767.90
-512.40
405.20
-476.60
386.00
209.50
-404.15
488.75
-175.70
-812.35
1094.45
-616.60
96.80
536.35
-310.60
-780.10
640.90
296.25
-140.35
-217.15
-688.80
1409.20
-1345.35
1017.00
-671.55
459.80
398.80
-441.35
-69.05
-68.25
-22.60
155.20
-521.25
731.00
-552.80
727.80
-1238.40
1723.60
-1272.55
-176.35
1258.90
-960.65
118.95
207.45
105.15
-1109.30
1400.20
-653.95
505.10
-341.45
-747.40
531.95
355.10
-7.80
-237.45
398.35
-184.20
-324.00
-246.35
573.55
-411.10
1010.70
-1305.00
1227.75
-1353.60
1461.35
-1061.25
259.50
162.80
-679.75
1035.95
-1128.00
1401.85
-864.70
-120.30
291.65
304.85
-345.10
-573.50
376.55
532.05
-962.10
746.65
-134.90
708.90
-921.60
152.15
15.60
-376.30
197.90
152.30
386.80
128.60
-1048.00
988.15
-491.10
495.10
-1198.30
1495.30
-805.60
-29.25
-96.65
43.15
241.25
290.10
-339.10
304.60
-725.20
889.10
-1204.00
601.80
481.65
-428.65
682.25
-1417.75
983.25
378.60
-1302.85
969.65
-398.65
414.00
-663.80
1147.70
-1237.90
368.40
846.80
-683.20
-707.15
1499.80
-875.10
-17.75
-141.30
-183.85
627.30
-479.60
788.85
-789.05
51.70
571.25
45.40
-698.35
530.40
10.50
-919.10
722.70
90.00
249.20
-662.35
620.20
-872.55
611.85
137.80
-900.70
651.10
542.60
-287.20
-623.15
37.55
389.05
124.80
385.25
-945.95
514.60
-171.60
580.15
-1103.50
489.15
622.25
-298.90
-1006.50
1107.50
-257.75
235.45
-674.75
-13.65
844.25
-664.10
8.80
488.10
-370.45
-60.85
-101.05
725.10
-142.50
-1158.65
953.30
389.85
-497.25
-527.90
1115.60
-835.50
-200.30
125.80
462.15
457.65
-1069.95
393.30
365.00
-778.90
1098.80
-1451.95
1421.30
-408.60
-246.25
-365.75
897.00
-886.45
691.75
-989.90
1437.00
-710.75
-190.25
91.75
-209.15
205.80
242.85
52.20
-696.40
991.95
-354.35
-777.45
923.05
-148.30
-637.55
946.10
-527.60
426.75
-760.60
636.65
-62.45
-762.75
826.05
-211.40
-478.60
950.00
-281.10
-309.00
213.00
-774.30
793.40
-404.85
622.50
-107.35
-920.10
1083.40
-167.55
-799.40
1026.20
-605.65
12.15
-98.25
905.05
-1553.30
1551.45
-1090.05
107.90
320.85
457.75
-712.95
82.80
-59.00
767.95
-690.45
661.40
-1289.85
728.55
361.65
-473.75
-150.65
489.50
407.00
-1430.85
1190.60
63.50
-1211.45
890.75
170.50
-697.00
1105.65
-809.70
-220.45
639.50
-77.85
-705.15
212.60
342.85
48.00
581.00
-1025.35
41.35
153.55
36.65
187.10
260.85
-540.70
712.10
-1150.40
728.90
253.80
-685.65
802.55
-806.45
-8.30
688.40
-853.65
507.85
717.15
-1056.05
858.45
-1268.25
567.85
967.20
-630.05
-1003.35
1105.50
78.45
-161.00
-111.20
-774.90
576.70
881.95
-903.95
391.90
-1073.10
1505.85
-929.60
-42.00
335.85
-6.05
457.80
-695.75
471.95
-505.90
41.95
563.20
-928.10
1061.40
-1046.15
668.80
190.15
-96.40
-102.05
-516.55
839.55
-422.25
-856.25
754.75
769.80
-1106.05
1031.20
-1350.00
1139.95
-732.30
744.80
-382.75
-170.45
278.30
100.95
-672.90
139.80
1180.60
-899.15
-559.30
637.70
117.15
1.35
-43.85
-111.20
-213.95
-350.80
883.70
-168.95
-688.85
831.10
-0.95
-460.45
65.10
391.40
-577.20
132.35
195.85
-138.00
-218.30
565.65
-393.90
361.10
-305.45
71.05
135.25
-493.30
338.00
-18.45
696.70
-906.65
-159.15
700.40
-884.70
1288.55
-745.85
-440.50
419.40
92.05
-147.60
317.25
337.35
-1189.35
1510.90
-950.30
-255.85
300.25
-87.95
179.90
-186.75
722.65
-670.75
398.90
-378.20
-432.10
739.10
-772.45
957.35
-308.05
12.55
-31.60
-920.80
1121.00
-67.60
-201.20
181.55
-629.30
791.00
-246.20
-688.60
1030.55
-685.40
350.35
-511.80
365.35
665.70
-1397.30
776.75
680.60
-724.35
176.00
-935.55
1205.10
-748.25
434.25
289.65
-762.00
116.35
125.10
875.60
-688.80
-378.20
457.90
-884.90
1119.50
-606.75
321.25
259.45
-35.70
-848.75
391.35
61.45
462.80
-739.15
881.30
-480.75
-725.00
1359.90
-1319.45
575.25
593.40
-1184.10
634.40
517.60
-848.55
757.90
-283.20
-165.65
-505.60
441.45
839.85
-728.95
-731.55
687.55
57.25
841.65
-1725.70
1151.05
-93.50
-457.30
36.00
1168.25
-1357.35
519.20
-363.20
-68.90
1111.50
-1563.45
1568.50
-1259.85
1015.70
-1198.15
1348.85
-914.30
318.85
-8.65
-347.00
307.00
-458.45
730.10
-289.70
-420.25
698.10
-225.80
-281.85
-18.85
624.10
-454.00
20.75
383.65
-556.55
-526.00
802.95
-73.55
-72.90
784.30
-949.55
-184.00
491.95
495.70
-474.40
-797.45
590.95
368.20
-492.05
887.60
-757.00
-446.10
1051.80
-392.15
-546.70
701.80
-491.15
646.10
-723.80
265.95
64.65
524.05
-734.10
-234.85
44.55
518.60
70.55
-252.80
-268.30
759.75
-85.25
-793.55
451.90
-344.55
723.80
-796.95
675.05
-606.20
638.60
-563.20
880.60
-725.05
-329.70
523.50
-60.20
-380.60
247.00
724.05
-1237.05
1006.15
-600.30
877.50
-1037.75
587.75
-660.05
286.15
281.40
233.60
-823.30
305.40
539.15
-747.95
525.70
384.85
-1160.50
439.65
758.40
-686.10
-203.25
210.35
640.75
-580.25
-472.05
549.70
114.60
-531.10
1158.35
-1449.10
967.50
21.50
-404.55
-724.85
1145.25
-10.60
-684.80
693.70
-546.40
146.40
-83.30
456.45
-599.65
342.10
192.15
-762.75
929.70
-830.30
460.60
409.25
-1203.25
834.50
-80.60
798.75
-1669.65
978.90
-240.00
265.25
339.60
-792.00
799.75
-1139.05
909.90
68.60
-620.20
317.85
-160.80
232.50
277.65
-386.30
-535.65
632.65
385.95
-634.80
-370.00
300.85
907.20
-1200.45
546.75
660.10
-1186.05
54.05
1290.00
-979.40
322.75
-444.55
-310.65
1026.50
-862.15
1223.80
-1640.90
809.20
205.60
258.65
-380.70
-410.20
738.90
-750.10
57.25
488.00
253.90
-631.05
-520.35
1282.25
-625.25
387.15
-995.25
874.60
151.50
-727.35
46.90
205.95
647.00
-885.25
939.30
-622.00
-464.00
126.85
950.15
-274.95
-528.55
478.65
-563.80
591.35
-1032.35
703.10
-109.90
560.10
-454.25
436.35
-374.20
-113.55
-101.35
230.80
-143.20
-117.55
818.50
-799.75
-86.90
6.85
641.75
-759.35
349.80
406.85
-41.75
-419.05
-303.70
662.45
-661.80
409.65
595.55
-514.00
-178.05
331.90
-914.65
1122.15
-72.35
-596.60
-232.45
203.85
923.45
-507.45
-378.95
-191.30
1115.80
-1279.00
203.40
470.00
-96.95
732.00
-1006.25
-108.85
344.50
537.70
-374.55
-887.65
995.65
-306.70
761.35
-1119.70
758.85
-449.95
357.90
-1028.15
1499.35
-663.25
-930.30
1220.55
177.30
-1181.55
546.30
-4.05
245.00
283.60
-630.85
885.60
-940.05
-389.15
1376.80
-667.85
63.80
-839.50
1135.05
-29.25
-523.25
247.75
-706.15
421.90
257.15
-58.00
586.30
-713.20
77.30
-55.15
219.20
94.60
-935.20
1295.55
-596.95
-45.35
58.75
-343.10
771.65
-339.30
133.45
-1075.00
1446.05
-1001.65
1134.95
-1078.05
484.55
6.00
-1013.75
913.15
476.20
-1061.05
1505.15
-1295.35
24.90
685.30
-509.15
67.35
-128.05
388.15
-177.30
240.15
-587.40
16.30
328.20
261.60
348.95
-1357.25
1163.55
-121.90
-761.50
172.70
461.80
-218.30
678.30
-722.60
-4.45
-74.25
-116.15
278.65
605.90
-1331.95
1405.55
-1261.00
1146.75
-507.60
-261.50
502.25
-305.30
-940.70
1569.70
-1059.80
774.40
-667.15
419.70
149.20
-649.35
537.10
421.30
-1146.65
1333.45
-1309.00
991.35
-243.15
-646.75
469.05
141.80
103.75
-454.10
143.65
182.25
187.30
-891.45
352.40
562.00
-435.60
368.15
-554.90
604.45
-277.80
116.90
-841.65
880.60
-51.35
-38.20
369.00
-1026.35
1155.30
-557.75
-324.95
383.85
-595.50
660.55
-445.65
325.60
-112.60
180.70
-147.70
162.95
108.25
-59.90
-652.50
1236.90
-980.95
-70.50
144.40
833.90
-1141.35
386.20
646.45
-956.85
444.60
255.45
-1145.45
1255.95
-330.65
-335.80
745.40
-943.60
946.80
-836.20
478.10
-749.95
1364.70
-1513.45
1177.30
-214.20
-710.60
567.20
46.65
317.60
-828.05
582.70
-441.75
155.70
310.90
-245.70
471.60
-639.80
314.80
-332.20
430.80
-276.15
19.50
-141.70
-111.75
396.70
608.45
-1589.30
1108.50
-99.60
-314.15
325.80
-1.05
283.45
-947.15
402.75
518.95
-832.75
936.85
-614.05
417.40
-567.80
425.45
-872.10
1047.60
-704.10
849.90
-481.35
11.90
-470.60
876.35
-70.45
-618.05
566.95
-953.85
923.50
-750.20
1254.05
-1478.20
980.45
354.75
-1011.65
784.40
-1011.15
540.40
-2.00
36.55
251.55
-211.85
514.40
-944.90
759.75
-420.35
-417.10
1249.55
-1519.90
1337.15
-735.30
-326.45
1407.85
-1307.20
-19.75
736.85
138.20
-666.00
-257.85
374.25
699.25
-820.80
29.50
414.65
-596.60
630.55
52.40
-1095.30
1463.25
-1344.65
1157.15
-865.45
1124.50
-1556.05
1122.55
118.10
-938.00
398.65
95.70
275.45
-206.70
198.45
-1080.25
1068.40
-142.20
-307.80
601.25
-660.50
510.80
-629.20
669.40
103.40
-316.35
-833.30
1173.80
-456.35
-41.85
332.55
-924.80
958.60
309.95
-853.90
-225.00
414.90
363.50
195.15
-463.40
-149.20
-84.60
-10.15
546.75
-616.10
472.05
-347.25
368.25
-427.95
553.85
-562.35
531.40
-622.50
514.15
-173.75
18.70
-416.50
624.20
-47.20
-611.60
414.10
174.45
107.05
-711.00
108.55
339.25
65.65
114.65
196.45
-439.75
0.95
-448.70
227.70
193.10
718.20
-1237.30
705.50
170.50
-28.30
-1032.10
971.30
431.45
-1392.85
1159.15
-205.65
-135.15
-715.35
709.85
413.60
-480.20
-472.60
624.30
-217.80
831.30
-1149.25
176.20
766.45
-388.30
-283.15
-309.85
1047.10
-1443.35
1070.20
211.50
-526.40
18.25
199.20
-181.00
-378.50
793.10
-323.40
-674.05
1303.35
-1323.55
1128.10
-876.75
783.50
-470.20
-420.40
913.05
-556.35
617.80
-868.95
82.75
653.60
-41.80
-290.10
-530.55
594.50
437.75
-347.65
-735.00
785.45
-555.65
861.95
-1187.45
1062.70
-236.20
-702.00
1042.25
-237.70
-505.65
539.00
-700.20
855.50
-1276.00
1178.50
-687.70
788.30
-274.35
-204.65
48.00
-226.75
416.60
-746.35
1214.95
-715.75
-165.50
81.00
150.90
-495.10
378.25
674.55
-1147.00
1479.90
-1434.85
85.30
898.70
-279.75
52.80
-870.40
1008.65
-990.75
677.90
580.50
-1002.85
164.45
259.90
186.05
-134.95
-497.95
919.25
-734.15
-215.30
751.85
-335.80
-364.40
722.10
-820.00
989.20
-389.20
-546.85
659.35
-756.35
836.70
-282.45
-551.15
510.85
698.95
-734.35
-579.75
758.25
59.45
-455.55
492.60
-1.25
-927.35
774.85
17.70
219.60
-171.45
-829.90
867.85
-172.25
-424.90
1042.65
-1020.40
358.35
267.20
-444.70
96.70
201.85
195.50
-1141.40
1470.40
-905.75
441.30
-627.30
1260.20
-876.45
-87.90
-42.20
387.40
3.50
-297.20
-274.60
593.85
-639.20
536.55
240.85
-547.70
788.65
-966.50
-133.80
1079.50
-582.50
-443.10
992.50
-694.75
-252.30
388.55
-84.30
1040.05
-1498.05
981.50
-900.35
600.10
240.65
-958.75
581.75
732.85
-1505.30
1183.70
-729.95
1096.70
-838.85
-75.10
-122.00
-56.40
918.20
-255.90
-747.45
754.95
-597.10
-21.25
841.75
-1419.65
905.40
295.40
53.70
-1170.85
1329.50
-509.80
254.50
-733.75
168.15
365.80
158.50
-39.55
-756.20
438.75
358.80
-65.10
-33.90
-777.20
747.60
272.35
-145.45
-1159.10
1578.25
-577.30
75.65
-283.45
-82.90
463.25
-252.60
-907.85
1235.85
63.20
-241.50
-875.40
896.35
-99.70
-147.30
311.80
-727.05
280.95
730.15
-1005.45
1267.85
-1286.35
913.60
-312.80
-1032.70
1184.70
129.65
-1011.75
1185.20
-1110.70
956.55
-184.05
-347.40
161.95
-512.70
725.40
-407.95
364.05
-241.90
51.10
-562.90
1471.95
-1306.80
628.45
-559.70
118.90
314.45
-155.80
-77.95
-160.00
967.35
-1235.85
910.15
-728.45
311.20
89.00
-79.35
50.75
-172.60
688.80
-372.00
-828.10
590.30
465.55
-823.15
542.35
57.20
292.40
-1115.25
1494.65
-1379.70
783.60
83.95
-1000.10
676.50
640.85
-1144.50
334.10
-36.50
327.25
403.05
-1050.55
908.75
-178.80
-182.30
-703.45
746.85
196.85
-17.10
-648.60
150.65
784.00
-629.45
-405.20
1128.90
-345.25
-522.55
194.55
-59.90
188.65
-347.25
142.05
769.40
-532.35
-934.90
1090.10
-74.70
-753.95
561.65
645.75
-702.40
251.30
-832.70
864.75
-166.05
-437.85
972.95
-1299.40
781.15
-186.40
167.75
154.65
441.60
-1017.50
-41.90
882.40
-804.35
498.55
130.55
-1000.30
539.85
435.90
3.25
-156.60
-108.55
-469.50
519.15
436.30
-1093.65
777.55
229.05
-596.50
64.75
356.55
-84.30
-907.80
1272.10
-366.65
-391.55
-354.20
1224.65
-1007.95
738.45
-220.55
-708.15
1243.20
-814.65
9.90
-337.05
362.75
-37.90
1088.30
-1488.80
305.45
294.00
385.60
-1078.25
649.95
835.10
-1018.35
336.20
-180.15
-222.55
206.70
263.10
-366.70
-400.40
387.35
2.55
931.55
-793.70
-455.55
137.90
1034.65
-790.80
-206.25
543.05
-224.50
97.20
-798.40
654.10
-137.75
1048.45
-1158.40
-241.95
318.90
1132.15
-1193.90
45.65
-246.00
651.40
-80.55
181.90
-793.30
376.75
905.05
-859.20
-678.30
1420.00
-1243.60
1054.35
-396.80
-500.80
58.35
831.50
-505.55
343.35
-984.15
1287.45
-962.10
-11.10
931.65
-457.40
-137.80
-284.10
-109.85
434.75
247.70
-624.50
391.65
698.75
-979.70
-143.15
693.05
-339.65
21.85
-553.00
598.45
195.45
-87.95
-171.65
454.80
-1292.75
1044.55
469.35
-900.00
-134.00
173.90
154.55
514.45
-133.50
-260.45
-594.90
925.35
-1049.00
1477.90
-1459.55
1114.85
-1054.15
1113.40
-869.05
679.60
-433.00
-123.65
589.90
-1003.90
1237.95
-1400.20
657.80
636.15
-824.30
144.60
525.55
-11.45
-509.85
-97.55
349.45
-168.85
51.65
126.10
-93.40
-392.30
872.00
-160.40
-859.30
1157.05
-1247.60
1074.75
-651.80
-353.20
945.35
-812.50
756.05
-542.85
585.50
0.10
-760.60
771.65
-368.10
-475.85
929.25
-1381.85
1079.05
9.55
-537.05
1113.60
-817.45
73.00
-378.20
664.00
-550.50
653.30
-886.70
863.85
-853.95
546.75
240.60
-148.50
-930.05
1267.80
-784.55
866.50
-662.10
-8.75
-141.45
761.15
-1059.95
319.20
443.90
213.20
-1191.20
628.95
431.55
-606.55
1153.95
-1252.80
-158.40
835.85
-186.40
-297.15
18.75
260.95
369.45
-691.05
537.80
-898.35
780.00
320.15
-999.90
482.95
276.55
-77.50
-531.70
405.20
277.35
-703.55
295.50
-121.10
1065.95
-988.45
92.20
-235.90
-14.60
-1.75
584.30
62.15
-101.70
-1152.30
1112.55
411.15
-1337.20
1188.45
-477.25
-466.15
372.65
-105.05
194.40
389.05
115.90
-1131.00
963.50
-223.70
-4.45
-846.05
682.80
143.55
168.30
124.35
-825.40
347.45
-351.05
504.60
322.95
117.60
-1371.35
966.05
57.50
-26.35
60.20
51.15
-1022.50
1345.10
-740.85
176.55
366.20
-355.25
-730.50
464.45
346.45
44.60
-254.45
151.90
-73.75
706.00
-900.15
327.10
-314.35
212.25
-334.90
746.40
-146.85
-1046.15
1624.50
-1523.50
524.60
217.30
455.10
-883.60
770.90
-272.10
-362.45
347.85
-612.80
393.90
382.20
-436.75
1031.55
-994.10
120.35
-679.65
507.65
636.55
-489.25
377.90
-1066.80
1496.75
-1287.60
1057.55
-1447.50
992.40
671.85
-1315.60
938.40
-264.70
-821.65
854.45
336.10
-743.60
431.80
-716.90
894.75
-825.95
878.45
-21.60
-457.35
-436.70
1061.15
-504.75
-748.60
1279.15
-764.05
15.10
441.60
-1016.45
1503.15
-993.80
279.00
-376.70
206.15
210.60
609.45
-885.00
342.90
-290.55
288.25
-1021.30
1745.75
-1183.40
646.15
-321.90
-224.50
-449.80
848.85
411.80
-718.90
-567.25
895.30
108.95
-424.50
368.85
-992.05
1377.00
-823.30
351.45
-837.65``````

### 10014 - Simple calculations - Compile error?(JAVA)

Posted: Wed Jul 02, 2003 10:42 am
Hi all,
Is there anybody here who can finish this problem by using Java?
Here is my code. I don't know why there is "Compile Error" ? I can run the program successfully in my PC.

[java]

import java.io.*;
import java.util.*;

class Main{

static String ReadLn (int maxLg){ // utility function to read from stdin

byte lin[] = new byte [maxLg];
int lg = 0, car = -1;
String line = "";

try{
while (lg < maxLg){
if ((car < 0) || (car == '\n')) break;
lin [lg++] += car;
}
}
catch (IOException e){
return (null);
}

if ((car < 0) && (lg == 0)) return (null); // eof
return (new String (lin, 0, lg));

public static void main (String args[]){ // entry point from OS

Main myWork = new Main(); // create a dinamic instance
myWork.Begin(); // the true entry point

} // end main method

void Begin(){
String input;

int n;
int counter = 0;
double a0,a2;

n = Integer.parseInt(input.trim());

double a1 [] = new double[n];
double c1 [] = new double[n];

a0 = Double.parseDouble(input.trim());

a2 = Double.parseDouble(input.trim());

while (counter<n){
c1[counter] = Double.parseDouble(input.trim());
counter++;
}

for (int i=0;i<n;i++){
a1 = (a0 + a2) / 2 - c1;
System.out.println(a1);
}

} // end Begin method

} // end Main class[/java][/code][/java]

### 10014

Posted: Wed Aug 13, 2003 6:06 pm
Hi...

10014...

I really don't know what's wrong with my code! Will you tell me??
Here is my code in C:

Code: Select all

``````/*
*	autor: Lamasanu Ion, July 2003
*	ACM Contest training
*
*	Simple calculations 10014
*/
#include <stdio.h>
int main(void)
{
int n, i;
double a0, a1, an1, Ci, S=0;
scanf("%d%lf%lf", &n, &a0, &an1);
for(i=1; i<=n; i++)
{
scanf("%lf", &Ci);
S += 2*(n-i+1)*Ci;
}
a1 = (an1+n*a0-S)/(n+1);
printf("%.2lf", a1 );
return 0;
}

``````
10098...

I got OLE error. Why? I write charcaters at sdtout with

Code: Select all

``putc(character, stdout);``

10011...
I've done this problem and I still don't Know what's wrong because I get WA. Can you give me more detailed Sample Input & Output? Text of the problem isn't clear for me.

10013...

and at the end, the SuperLong Sums problem is crazy.
I've solved it with farmalloc() for BorlandC ++ 3.1, because I need memory (~500KB), but I dont' know how to allocate memory in Linux judge system? Can you help mee?

Thanx for all...

Posted: Wed Aug 13, 2003 6:58 pm

OLE doesn't mean you have problems printing.. maybe you don't exit the program or something, and it goes into infinite loop, printing the last case over and over again..

In C, you use malloc... you can look that up..

For the other problems, explain what you did and I'll check it out later..

Posted: Sat Aug 16, 2003 2:21 pm
the problem gave me a headache because of the memory limit in Ural State OJ. but do they have a memory limit here? no indication

Posted: Sun Aug 17, 2003 6:27 pm

Hi, bugzpodder.

If there is no indication for the limit of memory, you can just assume

the limit of memory is 32MB.

Posted: Mon Aug 18, 2003 2:35 pm
Hi again...
Thanx for information...

I've done the 10098 problem, and I know how to do the SuperLong Sums problem...
But I still don't know how to solve 10011 and 10014.

For Simple Calculations(10014) I've solved the system of equations on paper. The formula for a1 is in the code of the program, but I don't know what's wrong.

### 10014

Posted: Tue Nov 25, 2003 11:49 am
TLE plz give me correct solution.

[c]

#include<stdio.h>
#include<math.h>

void main()
{
int i,n,j,k;
double a[10000]={0.0};
double sum=0.0;
while(scanf("%d",&i)!=EOF)
{
for(j=0;j<n;j++)
{
scanf("%d",&n);
for(k=0;k<n+2;k++)
scanf("%lf",&a[k]);
for(k=0;k<n;k++)
sum=(sum+(a[k+2]*(n-k)));
sum=((a[0]*n+a[1])-sum*2)/(n+1);
printf("%.2lf\n",sum);
sum=0;
}
}
}
[\c]

Posted: Wed Dec 10, 2003 10:52 am
[c]
I use this formula.but why TLE.plz help me.my source code is in above.
i increase array size to 1000000.

a1=(a0+a2)/2-c1
2a1=a0+a2-2c1
4a1=2a0+2a2-4c1 ... (1)

a2=(a1+a3)/2-c2
2a2=a1+a3-2c2 ... (2)

Combine (1) & (2)

4a1=2a0+(a1+a3-2c2)-4c1
3a1=2a0+a3-2(c2+2c1)

... and so on until n-th term ...

(n+1)a1=n*a0 + (an+1) - 2(n*c1 + (n-1)*c2 + (n-2)*c3 + ... + 1*cn)

[\c]

### 10014 why W.A

Posted: Sat Sep 25, 2004 10:16 am

#include<stdio.h>

int n,i,m,j;
float an1,a0,a1,c,csum;

void main()
{
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&n);
if(n>3000)
break;
scanf("%f",&a0);
if(a0<=-1000.00||a0>1000.00)
break;
scanf("%f",&an1);
if(an1<=-1000.00||an1>1000.00)
break;

for(j=0;j<n;j++)
{
scanf("%f",&c);
csum=csum+((n-j)*c);
}
a1= (((n*a0)+an1)-2*(csum))/(n+1);
printf("%.2f",a1);
}
}

Posted: Sun Sep 26, 2004 10:08 pm
Man man man

What happened? Are you new to acm.uva.es problemset?
Some key explanations:
- this problem requires multiple input
- revise your code, see that csum variable is not initialized after first calculation process
- the line
"printf("%.2f",a1); " must be transformed into
"printf("%.2f%s",a1, (i==m-1)? "\n": "\n\n" ); " to meet multiple input requirements

Good luck! and hope someone would be nice in helping me too. (I've got some topics unanswered)

### Thanks

Posted: Tue Sep 28, 2004 7:33 am
Thanks Matrix .I got Accepted At last.But I can't Understand How the Code Is Works In The Mul.Input Cases . Please Describe it.

Posted: Thu Sep 30, 2004 10:10 am

### 10014 Run Time Error

Posted: Sun Jan 01, 2006 2:25 pm
The following code is saying RTE. Can anyone tell me why??

#include <stdio.h>
#define SIZE 3000

float c[SIZE];
double a0, an1;
int n;

double func(int m);

double func(int m) {
if (m == 0)
return a0;
else if (m == n + 1)
return an1;
else
return (func(m - 1) + func(m + 1)) / 2.0 - c[m - 1];
}

void main() {
int test;
scanf("%d",&test);

for (int i = 1; i <= test; i++) {
scanf("%d%lf%lf",&n,&a0,&an1);

for (int j = 0; j < n; j++)
scanf("%f",&c[j]);

double va = func(1);

printf("%.2lf\n",va);

if (i != test)
printf("\n");
}
} [/img]