-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex21.cpp
More file actions
100 lines (90 loc) · 1.46 KB
/
Copy pathex21.cpp
File metadata and controls
100 lines (90 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include <bits/stdc++.h>
using namespace std;
int f0(int N)
{
return 1;
}
int f1(int N, int M)
{
int s = 0;
for (int i = 0; i < N; i++)
{
s++;
}
for (int i = 0; i < M; i++)
{
s++;
}
return s;
}
int f2(int N)
{
int s = 0;
for (int i = 0; i < N; i++)
{
int t = N;
int cnt = 0;
while (t > 0)
{
cnt++;
t /= 2;
}
s += cnt;
}
return s;
}
int f3(int N)
{
int s = 0;
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
s++;
}
}
return s;
}
int f4(int N)
{
int s = 0;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < N; j++)
{
s += i + j;
}
}
return s;
}
int f5(int N, int M)
{
int s = 0;
for (int i = 0; i < N; i++)
{
for (int j = 0; j < M; j++)
{
s += i + j;
}
}
return s;
}
int main()
{
int N, M;
cin >> N >> M;
int a0 = -1, a1 = -1, a2 = -1, a3 = -1, a4 = -1, a5 = -1;
// 計算量が最も大きいもの1つだけコメントアウトする
a0 = f0(N);
a1 = f1(N, M);
a2 = f2(N);
a3 = f3(N);
// a4 = f4(N);
a5 = f5(N, M);
cout << "f0: " << a0 << endl;
cout << "f1: " << a1 << endl;
cout << "f2: " << a2 << endl;
cout << "f3: " << a3 << endl;
cout << "f4: " << a4 << endl;
cout << "f5: " << a5 << endl;
}