File tree Expand file tree Collapse file tree 3 files changed +84
-0
lines changed Expand file tree Collapse file tree 3 files changed +84
-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 S, T;
12
+ cin >> S >> T;
13
+ cout << (T - S + 1 ) << endl;
14
+
15
+ return 0 ;
16
+ }
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;
12
+ cin >> N;
13
+
14
+ map<string,int > votes;
15
+ string s;
16
+ for (int i = 0 ; i < N; i++) {
17
+ cin >> s;
18
+ votes[s]++;
19
+ }
20
+
21
+ int maxi = 0 ;
22
+ string top;
23
+ for (auto const & e : votes) {
24
+ if (e.second > maxi) {
25
+ maxi = e.second ;
26
+ top = e.first ;
27
+ }
28
+ }
29
+ cout << top << endl;
30
+
31
+ return 0 ;
32
+ }
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 > C;
9
+
10
+ ff solve () {
11
+ ff exp = 0 ;
12
+ for (int i = 0 ; i < N; ++i) {
13
+ int M = 0 ;
14
+ for (int j = 0 ; j < N; ++j) {
15
+ if (i == j) continue ;
16
+ if (C[i] % C[j] == 0 ) ++M;
17
+ }
18
+ ff px = ff (M / 2 + 1 ) / (M + 1 );
19
+ exp += px;
20
+ }
21
+ return exp;
22
+ }
23
+
24
+ int main () {
25
+ ios_base::sync_with_stdio (false );
26
+ cin.tie (0 ); cout.tie (0 );
27
+
28
+ cin >> N;
29
+ C.assign (N, 0 );
30
+ for (int i = 0 ; i < N; ++i) {
31
+ cin >> C[i];
32
+ }
33
+ cout << fixed << setprecision (12 ) << solve () << endl;
34
+
35
+ return 0 ;
36
+ }
You can’t perform that action at this time.
0 commit comments