Skip to content

Commit 3f026ca

Browse files
authored
Merge pull request #456 from xirc/atcoder/abc144
AtCoder/ABC144
2 parents 5a7f63d + dce2a5f commit 3f026ca

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed

atcoder/abc144/A/main.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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;
12+
cin >> A >> B;
13+
14+
if (A >= 10 || B >= 10) {
15+
cout << -1 << endl;
16+
} else {
17+
cout << (A * B) << endl;
18+
}
19+
20+
return 0;
21+
}

atcoder/abc144/B/main.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
bool found = false;
14+
for (int x = 1; x <= 9; ++x) {
15+
for (int y = 1; y <= 9; ++y) {
16+
if (x * y == N) {
17+
found = true;
18+
break;
19+
}
20+
}
21+
}
22+
cout << (found ? "Yes" : "No") << endl;
23+
24+
return 0;
25+
}

atcoder/abc144/C/main.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
using ll = int64_t;
5+
using ff = long double;
6+
7+
ll solve(ll N) {
8+
ll ans = N;
9+
for (ll x = 1; x * x <= N; ++x) {
10+
if (N % x == 0) {
11+
ll y = N / x;
12+
ans = min(ans, (x-1)+(y-1));
13+
}
14+
}
15+
return ans;
16+
}
17+
18+
int main() {
19+
ios_base::sync_with_stdio(false);
20+
cin.tie(0); cout.tie(0);
21+
22+
ll N;
23+
cin >> N;
24+
cout << solve(N) << endl;
25+
26+
return 0;
27+
}

atcoder/abc144/D/main.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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, x;
12+
cin >> a >> b >> x;
13+
ff theta;
14+
if (2 * x >= a * a * b) {
15+
theta = atan2(2 * a * a * b - 2 * x, a * a * a);
16+
} else {
17+
theta = M_PI / ff(2.0) - atan2(2 * x, a * b * b);
18+
}
19+
theta = theta * ff(180) / M_PI;
20+
cout << fixed << setprecision(7) << theta << endl;
21+
22+
return 0;
23+
}

0 commit comments

Comments
 (0)