File tree Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Expand file tree Collapse file tree 3 files changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = int64_t ;
5
+ using ff = long double ;
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (0 ); cout.tie (0 );
10
+
11
+ int X;
12
+ cin >> X;
13
+
14
+ int S = 0 ;
15
+ for (int i = 1 ; i <= X; ++i) {
16
+ S += i;
17
+ }
18
+ cout << fixed << setprecision (7 ) << (ll (S) * 10000 / ff (X)) << endl;
19
+
20
+ return 0 ;
21
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = int64_t ;
5
+ using ff = long double ;
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (0 ); cout.tie (0 );
10
+
11
+ string S, T;
12
+ cin >> S >> T;
13
+ assert (S.size () == T.size ());
14
+
15
+ string wildcards = " atcoder" ;
16
+ bool win = true ;
17
+ int N = S.size ();
18
+ for (int i = 0 ; i < N; ++i) {
19
+ if (S[i] == T[i]) continue ;
20
+ if (S[i] != ' @' && T[i] != ' @' ) {
21
+ win = false ;
22
+ break ;
23
+ }
24
+ char c = ' ' ;
25
+ if (S[i] == ' @' ) c = T[i];
26
+ if (T[i] == ' @' ) c = S[i];
27
+ if (c != ' @' && wildcards.find (c) == string::npos) {
28
+ win = false ;
29
+ break ;
30
+ }
31
+ }
32
+ if (win) {
33
+ cout << " You can win" << endl;
34
+ } else {
35
+ cout << " You will lose" << endl;
36
+ }
37
+
38
+ return 0 ;
39
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = int64_t ;
5
+ using ff = long double ;
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (0 ); cout.tie (0 );
10
+
11
+ int N, K;
12
+ vector<int > R;
13
+
14
+ cin >> N >> K;
15
+ R.assign (N, 0 );
16
+ for (auto &r : R) cin >> r;
17
+ sort (R.begin (), R.end ());
18
+ ff rate = 0 ;
19
+ for (int i = N - K; i < N; ++i) {
20
+ rate = (rate + R[i]) / 2 ;
21
+ }
22
+ cout << fixed << setprecision (7 ) << rate << endl;
23
+
24
+ return 0 ;
25
+ }
You can’t perform that action at this time.
0 commit comments