File tree 4 files changed +124
-0
lines changed
4 files changed +124
-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 = long long ;
5
+
6
+ int main () {
7
+ ios_base::sync_with_stdio (false );
8
+ cin.tie (0 ); cout.tie (0 );
9
+
10
+ int r, g, b;
11
+ cin >> r >> g >> b;
12
+ int rgb = r * 100 + g * 10 + b;
13
+ if (rgb % 4 == 0 ) {
14
+ cout << " YES" << endl;
15
+ } else {
16
+ cout << " NO" << endl;
17
+ }
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 = long long ;
5
+
6
+ int N;
7
+ vector<int > A;
8
+
9
+ int solve () {
10
+ int mini = *min_element (A.begin (), A.end ());
11
+ int maxi = *max_element (A.begin (), A.end ());
12
+ return maxi - mini;
13
+ }
14
+
15
+ int main () {
16
+ ios_base::sync_with_stdio (false );
17
+ cin.tie (0 ); cout.tie (0 );
18
+
19
+ cin >> N;
20
+ A.assign (N, 0 );
21
+ for (int i = 0 ; i < N; ++i) {
22
+ cin >> A[i];
23
+ }
24
+ cout << solve () << endl;
25
+
26
+ return 0 ;
27
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = long long ;
5
+
6
+ int N;
7
+ vector<int > A;
8
+
9
+ vector<int > solve () {
10
+ int K = 0 ;
11
+ unordered_set<int > S;
12
+ for (auto a : A) {
13
+ if (a < 400 ) S.insert (0 );
14
+ else if (a < 800 ) S.insert (1 );
15
+ else if (a < 1200 ) S.insert (2 );
16
+ else if (a < 1600 ) S.insert (3 );
17
+ else if (a < 2000 ) S.insert (4 );
18
+ else if (a < 2400 ) S.insert (5 );
19
+ else if (a < 2800 ) S.insert (6 );
20
+ else if (a < 3200 ) S.insert (7 );
21
+ else ++K;
22
+ }
23
+ if (S.empty ()) return { 1 , K };
24
+ return { (int )S.size (), (int )S.size () + K };
25
+ }
26
+
27
+ int main () {
28
+ ios_base::sync_with_stdio (false );
29
+ cin.tie (0 ); cout.tie (0 );
30
+
31
+ cin >> N;
32
+ A.assign (N, 0 );
33
+ for (int i = 0 ; i < N; ++i) {
34
+ cin >> A[i];
35
+ }
36
+ auto minmax = solve ();
37
+ cout << minmax[0 ] << " " << minmax[1 ] << endl;
38
+
39
+ return 0 ;
40
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+ using ll = long long ;
5
+
6
+ int N;
7
+ string S;
8
+
9
+ string solve () {
10
+ deque<char > Q;
11
+ int k = 0 ;
12
+ for (auto c : S) {
13
+ if (c == ' (' ) {
14
+ Q.push_back (c);
15
+ k++;
16
+ } else if (c == ' )' ) {
17
+ Q.push_back (c);
18
+ if (k > 0 ) --k;
19
+ else Q.push_front (' (' );
20
+ }
21
+ }
22
+ while (k > 0 ) {
23
+ Q.push_back (' )' );
24
+ --k;
25
+ }
26
+ return string (Q.begin (), Q.end ());
27
+ }
28
+
29
+ int main () {
30
+ ios_base::sync_with_stdio (false );
31
+ cin.tie (0 ); cout.tie (0 );
32
+
33
+ cin >> N >> S;
34
+ cout << solve () << endl;
35
+
36
+ return 0 ;
37
+ }
You can’t perform that action at this time.
0 commit comments