File tree Expand file tree Collapse file tree 4 files changed +118
-0
lines changed Expand file tree Collapse file tree 4 files changed +118
-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 A, B, C, D;
12
+ cin >> A >> B >> C >> D;
13
+ int N = min ({ A, B, C, D });
14
+ cout << N << 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 main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (0 ); cout.tie (0 );
10
+
11
+ int N, M, T;
12
+ cin >> N >> M >> T;
13
+
14
+ bool success = true ;
15
+ int time = 0 ;
16
+ int remaining = N;
17
+ for (int mm = 0 ; mm < M; ++mm) {
18
+ int A, B;
19
+ cin >> A >> B;
20
+ int consumed = A - time ;
21
+ remaining -= consumed;
22
+ if (remaining <= 0 ) {
23
+ success = false ;
24
+ break ;
25
+ }
26
+ int charged = B - A;
27
+ remaining += charged;
28
+ remaining = min (remaining, N);
29
+ time = B;
30
+ }
31
+ int consumed = T - time ;
32
+ remaining -= consumed;
33
+ if (remaining <= 0 ) success = false ;
34
+
35
+ cout << (success ? " Yes" : " No" ) << endl;
36
+
37
+ return 0 ;
38
+ }
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 L;
12
+ cin >> L;
13
+
14
+ ll ans = 1 ;
15
+ for (int i = 1 ; i <= 11 ; ++i) {
16
+ ans *= L- i;
17
+ ans /= i;
18
+ }
19
+ cout << ans << endl;
20
+
21
+ return 0 ;
22
+ }
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, M;
8
+ vector<int > A;
9
+
10
+ int solve () {
11
+ A.push_back (0 );
12
+ A.push_back (N + 1 );
13
+ sort (A.begin (), A.end ());
14
+
15
+ int w = N;
16
+ for (int i = 0 ; i + 1 < A.size (); ++i) {
17
+ int space = A[i+1 ] - A[i] - 1 ;
18
+ if (space > 0 ) {
19
+ w = min (w, space);
20
+ }
21
+ }
22
+
23
+ int ans = 0 ;
24
+ for (int i = 0 ; i + 1 < A.size (); ++i) {
25
+ int space = A[i+1 ] - A[i] - 1 ;
26
+ ans += (space + w - 1 ) / w;
27
+ }
28
+ return ans;
29
+ }
30
+
31
+ int main () {
32
+ ios_base::sync_with_stdio (false );
33
+ cin.tie (0 ); cout.tie (0 );
34
+
35
+ cin >> N >> M;
36
+ A.assign (M, 0 );
37
+ for (auto &a : A) cin >> a;
38
+ cout << solve () << endl;
39
+
40
+ return 0 ;
41
+ }
You can’t perform that action at this time.
0 commit comments