File tree Expand file tree Collapse file tree 3 files changed +96
-0
lines changed Expand file tree Collapse file tree 3 files changed +96
-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
+ vector<int > ls (3 );
12
+ cin >> ls[0 ] >> ls[1 ] >> ls[2 ];
13
+ int ans = 0 ;
14
+ if (ls[0 ] == ls[1 ]) ans = ls[2 ];
15
+ if (ls[1 ] == ls[2 ]) ans = ls[0 ];
16
+ if (ls[2 ] == ls[0 ]) ans = ls[1 ];
17
+ cout << ans << endl;
18
+
19
+ return 0 ;
20
+ }
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 N;
8
+ vector<int > A;
9
+
10
+ int solve () {
11
+ int M = accumulate (A.begin (), A.end (), 0 , plus<int >());
12
+ if (M % N != 0 ) return -1 ;
13
+ M /= N;
14
+
15
+ int ans = 0 ;
16
+ int acc = 0 ;
17
+ for (auto ai : A) {
18
+ acc += ai - M;
19
+ if (acc != 0 ) ans += 1 ;
20
+ }
21
+ return ans;
22
+ }
23
+
24
+ int main () {
25
+ ios_base::sync_with_stdio (false );
26
+ cin.tie (0 ); cout.tie (0 );
27
+
28
+ cin >> N;
29
+ A.assign (N, 0 );
30
+ for (auto &ai : A) cin >> ai;
31
+ cout << solve () << endl;
32
+
33
+ return 0 ;
34
+ }
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 bits (ll N) {
8
+ int bc = 0 ;
9
+ while (N > 0 ) {
10
+ N >>= 1 ;
11
+ ++bc;
12
+ }
13
+ return bc;
14
+ }
15
+
16
+ bool solve (ll N) {
17
+ int const M = bits (N);
18
+ ll v = 1 ;
19
+ int i = 0 ;
20
+ for (; v <= N; ++i) {
21
+ v <<= 1 ;
22
+ if (i % 2 == 0 && M % 2 == 1 ) {
23
+ v += 1 ;
24
+ }
25
+ if (i % 2 == 1 && M % 2 == 0 ) {
26
+ v += 1 ;
27
+ }
28
+ }
29
+ return i % 2 == 0 ;
30
+ }
31
+
32
+ int main () {
33
+ ios_base::sync_with_stdio (false );
34
+ cin.tie (0 ); cout.tie (0 );
35
+
36
+ ll N;
37
+ cin >> N;
38
+ auto ans = solve (N) ? " Takahashi" : " Aoki" ;
39
+ cout << ans << endl;
40
+
41
+ return 0 ;
42
+ }
You can’t perform that action at this time.
0 commit comments