Skip to content

Commit a2e0e93

Browse files
committed
gcj14 qual
1 parent ddb52fd commit a2e0e93

File tree

11 files changed

+2210
-0
lines changed

11 files changed

+2210
-0
lines changed

GCJ/14/Qual/A-small-practice.in

Lines changed: 1001 additions & 0 deletions
Large diffs are not rendered by default.

GCJ/14/Qual/A.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <iostream>
2+
#include <sstream>
3+
#include <string>
4+
#include <cstring>
5+
#include <vector>
6+
#include <map>
7+
#include <algorithm>
8+
using namespace std;
9+
10+
#define REP(i,n) for(int i=0;i<(n);++i)
11+
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
12+
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
13+
typedef long long LL;
14+
15+
vector<int> doit() {
16+
vector<int> res;
17+
int r;
18+
cin >> r;
19+
REP(i,4) {
20+
REP(j,4) {
21+
int num;
22+
cin >> num;
23+
if (i + 1 == r) res.push_back(num);
24+
}
25+
}
26+
return res;
27+
}
28+
29+
void run() {
30+
vector<int> m1 = doit();
31+
vector<int> m2 = doit();
32+
33+
sort(m1.begin(), m1.end());
34+
sort(m2.begin(), m2.end());
35+
36+
vector<int> mm(8);
37+
vector<int>::iterator it = set_intersection(m1.begin(), m1.end(), m2.begin(), m2.end(), mm.begin());
38+
mm.resize(it - mm.begin());
39+
40+
if (mm.size() == 1) cout << mm[0] << endl;
41+
else if (mm.size() == 0) cout << "Volunteer cheated!" << endl;
42+
else cout << "Bad magician!" << endl;
43+
}
44+
45+
int main() {
46+
int k;
47+
cin >> k;
48+
FOR(c,1,k) {
49+
cout << "Case #" << c << ": ";
50+
run();
51+
}
52+
return 0;
53+
}

GCJ/14/Qual/B-large-practice.in

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
100
2+
9997.78110 1.43881 99948.39252
3+
326.25950 11.41164 408.90442
4+
9998.02965 1.43894 99949.39177
5+
8377.0 99.0 9452.0
6+
8579.0 22.0 87049.0
7+
1.03397 99.87614 99999.03277
8+
943.09559 87.54924 850.69923
9+
9039.0 12.0 16015.0
10+
9991.41765 1.43625 99973.04386
11+
9993.45814 1.28567 99917.14714
12+
681.20500 43.71507 784.18869
13+
11.86478 96.27220 80.09964
14+
199.0 41.97510 1174.42
15+
6256.0 53.0 19191.0
16+
9992.94153 1.01425 99933.58858
17+
4851.0 15.0 95663.0
18+
642.0 100.0 1174.493
19+
2.65322 39.72923 495.67044
20+
640.5967 72.8 557.0
21+
1206.38 28.0 733.9
22+
9994.94907 1.17306 99983.50333
23+
9992.47016 1.43355 99994.61440
24+
9995.91566 1.11788 99916.42605
25+
6359.00000 55.00000 6999.00000
26+
6550.0 37.0 75815.0
27+
1254.40 23.2 62.46543
28+
403.331 81.0 622.16
29+
9994.44434 1.33325 99999.14764
30+
9998.91787 1.38842 99941.56683
31+
1.00584 99.44122 99999.32961
32+
9998.51123 1.35155 99981.54018
33+
9995.74593 1.18034 99985.87755
34+
8189.00000 2.00000 16378.00000
35+
8685.00000 2.00000 17370.00000
36+
9992.02192 1.34003 99986.57955
37+
9627.00000 30.00000 10313.00000
38+
9992.55241 1.16168 99928.62750
39+
1342.074 99.1955 821.766
40+
1065.06835 33.74359 431.07508
41+
1.06496 99.03915 99999.70541
42+
157.02576 57.24591 550.71004
43+
9888.0 17.0 55846.0
44+
498.93041 19.74884 888.67778
45+
1765.0 52.0 83488.0
46+
9990.98062 1.47327 99991.05576
47+
1404.414 15.02696 1062.664
48+
1109.44819 54.16260 394.82665
49+
399.69 47.3059 342.4293
50+
1696.0 65.0 31822.0
51+
805.260 30.6330 746.16
52+
9995.98574 1.38412 99918.63831
53+
9996.78910 1.05881 99954.69800
54+
517.38923 86.34751 1153.83714
55+
643.17247 41.46567 1073.06369
56+
164.82261 85.65702 1030.81762
57+
956.0 38.7919 1078.74669
58+
9998.27567 1.28835 99955.57701
59+
9996.24660 1.02982 99930.84923
60+
7151.00000 2.00000 14302.00000
61+
9994.32519 1.23337 99953.09100
62+
197.5430 70.733 138.14
63+
9992.82622 1.48116 99965.39189
64+
1.01679 99.71279 99999.10926
65+
9998.13994 1.33656 99935.98822
66+
9995.79314 1.24242 99993.11612
67+
1373.17067 90.47965 248.69588
68+
9995.99417 1.39052 99907.76415
69+
9074.0 64.0 80682.0
70+
448.42514 81.96452 67.68708
71+
9997.39141 1.22068 99931.76827
72+
680.7 37.5178 1192.813
73+
494.02748 91.42330 408.78447
74+
9994.82497 1.05904 99936.53708
75+
9996.04416 1.45830 99947.11989
76+
1009.8 85.0 656.96378
77+
9997.67888 1.39810 99948.44903
78+
10000.00000 75.76 124.0
79+
4428.0 2.0 96653.0
80+
9996.79857 1.36829 99956.68965
81+
999.0 98.0 36612.0
82+
8926.00000 2.00000 9086.00000
83+
9996.97186 1.45134 99960.19862
84+
333.47049 24.20664 168.18935
85+
184.00000 2.00000 368.00000
86+
9991.18796 1.19218 99983.95885
87+
9998.49793 1.23181 99968.21567
88+
1328.11700 12.86887 334.04339
89+
1132.75097 55.40585 375.35890
90+
216.134 77.87 447.8095
91+
74.74168 29.15693 140.07748
92+
9404.00000 56.00000 9586.00000
93+
210.3 97.70885 555.17914
94+
548.8992 2.92 139.16996
95+
516.41256 12.73446 931.80242
96+
640.46 87.829 100000.0
97+
6500.0 40.0 88437.0
98+
9996.30940 1.15037 99907.26501
99+
9990.04994 1.09559 99924.40058
100+
575.82140 74.87741 926.52047
101+
9996.44823 1.49213 99939.52448

GCJ/14/Qual/B-small-practice.in

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
100
2+
189.00000 2.00000 378.00000
3+
185.00000 2.00000 370.00000
4+
495.98574 1.38412 1918.63831
5+
261.00000 3.00000 282.00000
6+
351.0 3.0 1663.0
7+
497.78110 1.43881 1948.39252
8+
448.42514 3.96389 1282.43927
9+
388.0 1.0 1846.0
10+
500.0 4.0 437.0
11+
448.8975 1.625 868.311
12+
496.44823 1.49213 1939.52448
13+
471.3065 3.30377 1275.30
14+
358.977 3.1 770.0
15+
50.0 1.0 1815.0
16+
24.89865 3.0 1430.2
17+
494.94907 1.17306 1983.50333
18+
495.74593 1.18034 1985.87755
19+
1.03397 3.87614 1999.03277
20+
498.91787 1.38842 1941.56683
21+
497.67888 1.39810 1948.44903
22+
490.04994 1.09559 1924.40058
23+
495.99417 1.39052 1907.76415
24+
240.487 1.898 945.57624
25+
69.651 1.1 2000.000
26+
64.38 3.93 843.9
27+
385.0 2.88 1434.5764
28+
498.27567 1.28835 1955.57701
29+
498.49793 1.23181 1968.21567
30+
74.0 4.0 682.0
31+
196.0 1.0 1822.0
32+
69.09116 3.24573 550.71004
33+
492.82622 1.48116 1965.39189
34+
498.13994 1.33656 1935.98822
35+
494.44434 1.33325 1999.14765
36+
497.39141 1.22068 1931.76827
37+
496.78910 1.05881 1954.69800
38+
459.0 1.6893 137.12
39+
70.0 4.0 780.66611
40+
498.93041 1.74864 104.42997
41+
287.5 1.77252 1.000
42+
134.75097 1.40516 375.35890
43+
76.82140 2.87716 142.27266
44+
151.00000 2.00000 302.00000
45+
496.97186 1.45134 1960.19862
46+
494.02748 1.42317 1623.53666
47+
492.02192 1.34003 1986.57955
48+
184.00000 2.00000 368.00000
49+
495.91566 1.11788 1916.42605
50+
491.18796 1.19218 1983.95885
51+
1.14558 2.53715 2.32116
52+
498.02965 1.43894 1949.39177
53+
492.55241 1.16168 1928.62750
54+
496.24660 1.02982 1930.84923
55+
494.32519 1.23337 1953.09100
56+
352.00000 2.00000 377.00000
57+
493.45814 1.28567 1917.14714
58+
186.50373 1.6 1800.3915
59+
1.06496 3.03915 1999.70541
60+
500.000 1.0 1947.1035
61+
480.9 3.655 1641.194
62+
485.80709 2.15631 140.07748
63+
144.17247 2.46515 1073.06369
64+
499.0 2.0 612.0
65+
496.30940 1.15037 1907.26501
66+
375.17067 3.47920 1463.44808
67+
39.0 4.0 15.0
68+
111.44819 3.16192 394.82665
69+
492.47016 1.43355 1994.61440
70+
496.79857 1.36829 1956.68965
71+
330.11700 3.86826 1548.79558
72+
182.20500 1.71499 784.18869
73+
394.0 1.0000 640.6
74+
352.00000 2.00000 400.00000
75+
1.0 2.9308 1820.79194
76+
265.0 4.0 1488.0
77+
494.82497 1.05904 1936.53708
78+
1.00584 3.44122 1999.32961
79+
326.25950 2.41132 408.90442
80+
496.04416 1.45830 1947.11989
81+
377.0 3.0 1452.0
82+
1.01679 3.71279 1999.10926
83+
81.1 2.0 1867.0
84+
491.41765 1.43625 1973.04386
85+
490.98062 1.47327 1991.05576
86+
356.73071 3.216 1285.85483
87+
428.47797 3.73385 147.55462
88+
444.09559 3.54896 850.69923
89+
256.0 1.0 1191.0
90+
413.71863 3.72899 495.67044
91+
79.0 2.0 1049.0
92+
498.51123 1.35155 1981.54018
93+
428.0 2.0 653.0
94+
492.94153 1.01425 1933.58858
95+
333.47049 3.20654 168.18935
96+
67.06835 3.74304 431.07508
97+
18.38923 2.34748 1153.83714
98+
339.00000 4.00000 359.00000
99+
164.82261 1.65667 1030.81762
100+
495.79314 1.24242 1993.11612
101+
3.80342 1.9 883.302

GCJ/14/Qual/B.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#include <iostream>
2+
#include <sstream>
3+
#include <string>
4+
#include <cstring>
5+
#include <vector>
6+
#include <map>
7+
#include <algorithm>
8+
using namespace std;
9+
10+
#define REP(i,n) for(int i=0;i<(n);++i)
11+
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
12+
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
13+
typedef long long LL;
14+
15+
void run() {
16+
double C, F, X;
17+
cin >> C >> F >> X;
18+
double res = X / 2.0, now = 0.0, rate = 2.0;
19+
while (now < res) {
20+
now += C / rate;
21+
rate += F;
22+
res = min(res, now + X / rate);
23+
}
24+
cout.precision(7);
25+
cout.setf(ios::fixed, ios::floatfield);
26+
cout << res << endl;
27+
}
28+
29+
int main() {
30+
int k;
31+
cin >> k;
32+
FOR(c,1,k) {
33+
cout << "Case #" << c << ": ";
34+
run();
35+
}
36+
return 0;
37+
}

0 commit comments

Comments
 (0)