File tree Expand file tree Collapse file tree 3 files changed +65
-0
lines changed Expand file tree Collapse file tree 3 files changed +65
-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
+ string N;
12
+ cin >> N;
13
+ auto same = (N[0 ] == N[1 ] && N[1 ] == N[2 ] && N[2 ] == N[3 ]);
14
+ cout << (same ? " SAME" : " DIFFERENT" ) << endl;
15
+
16
+ return 0 ;
17
+ }
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<string> S;
9
+ vector<int > P;
10
+
11
+ string solve () {
12
+ int sumP = 0 ;
13
+ for (int i = 0 ; i < N; ++i) {
14
+ sumP += P[i];
15
+ }
16
+ for (int i = 0 ; i < N; ++i) {
17
+ if (P[i] * 2 > sumP) {
18
+ return S[i];
19
+ }
20
+ }
21
+ return " atcoder" ;
22
+ }
23
+
24
+ int main () {
25
+ ios_base::sync_with_stdio (false );
26
+ cin.tie (0 ); cout.tie (0 );
27
+
28
+ cin >> N;
29
+ S.assign (N, " " );
30
+ P.assign (N, 0 );
31
+ for (int i = 0 ; i < N; ++i) {
32
+ cin >> S[i] >> P[i];
33
+ }
34
+
35
+ auto ans = solve ();
36
+ cout << ans << endl;
37
+
38
+ return 0 ;
39
+ }
Original file line number Diff line number Diff line change
1
+ object Main extends App {
2
+ val exp = scala.io.StdIn .readLine()
3
+ val terms = exp.split('+' )
4
+ val ans = terms.map { term =>
5
+ val hasZero = term.split('*' ).map(_.toInt).exists(_ == 0 )
6
+ if (hasZero) 0 else 1
7
+ }.sum
8
+ println(ans)
9
+ }
You can’t perform that action at this time.
0 commit comments