diff --git a/.DS_Store b/.DS_Store index 4fcf776..55720eb 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/AtCoder/.DS_Store b/AtCoder/.DS_Store new file mode 100644 index 0000000..d5f2986 Binary files /dev/null and b/AtCoder/.DS_Store differ diff --git a/AtCoder/ABC_400/A b/AtCoder/ABC_400/A new file mode 100755 index 0000000..b63319c Binary files /dev/null and b/AtCoder/ABC_400/A differ diff --git a/AtCoder/ABC_400/A.cpp b/AtCoder/ABC_400/A.cpp new file mode 100644 index 0000000..4ea075a --- /dev/null +++ b/AtCoder/ABC_400/A.cpp @@ -0,0 +1,21 @@ +#include +#define lo long long +#define INF INT_MAX +#define LLM LONG_LONG_MAX +#define endl "\n" + +using namespace std; +/* + toothless. #17 + @fredcss_dev +*/ + +int a; + +signed main() +{ + cin >> a; + if (400 % a == 0) cout << 400 / a; + else cout << -1; + return 0; +} \ No newline at end of file diff --git a/AtCoder/ABC_400/B b/AtCoder/ABC_400/B new file mode 100755 index 0000000..65c16f7 Binary files /dev/null and b/AtCoder/ABC_400/B differ diff --git a/AtCoder/ABC_400/B.cpp b/AtCoder/ABC_400/B.cpp new file mode 100644 index 0000000..214dbaa --- /dev/null +++ b/AtCoder/ABC_400/B.cpp @@ -0,0 +1,55 @@ +#include +#define lo long long +#define INF INT_MAX +#define LLM LONG_LONG_MAX +#define endl "\n" + +using namespace std; +/* + toothless. #17 + @fredcss_dev +*/ + +signed main() { + int N, M; + cin >> N >> M; + + if (N == 1) { + lo total = M + 1LL; + if (total > 1e9) { + cout << "inf" << endl; + } else { + cout << total << endl; + } + } else { + lo sum = 0; + lo cur = 1; + bool f = false; + for (int i = 0; i <= M; ++i) { + sum += cur; + if (sum > 1e9) { + f = true; + break; + } + if (i == M) { + break; + } + if (cur > 1e9 / N) { + f = true; + break; + } + lo next = cur * N; + if (next > (1e9 - sum)) { + f = true; + break; + } + cur = next; + } + if (f) { + cout << "inf" << endl; + } else { + cout << sum << endl; + } + } + return 0; +} diff --git a/AtCoder/ABC_400/C b/AtCoder/ABC_400/C new file mode 100755 index 0000000..f38fa48 Binary files /dev/null and b/AtCoder/ABC_400/C differ diff --git a/AtCoder/ABC_400/C.cpp b/AtCoder/ABC_400/C.cpp new file mode 100644 index 0000000..9194b47 --- /dev/null +++ b/AtCoder/ABC_400/C.cpp @@ -0,0 +1,41 @@ +#include +#define lo long long +#define INF INT_MAX +#define LLM LONG_LONG_MAX +#define endl "\n" + +using namespace std; +/* + toothless. #17 + @fredcss_dev +*/ + + +signed main() { + int N; + cin >> N; + + int cnt = 0; + int mx = 0; + int current = 1; + + while (current <= N) { + current *= 2; + mx++; + } + mx--; + + for (int e = 1; e <= mx; ++e) { + int m = N / (1 << e); + if (m < 1) { + continue; + } + int mx2 = sqrt(m); + int cnt = (mx2 + 1) / 2; + cnt += cnt; + } + + cout << cnt << endl; + + return 0; +} \ No newline at end of file diff --git a/AtCoder/ABC_400/C.py b/AtCoder/ABC_400/C.py new file mode 100644 index 0000000..e1c30ce --- /dev/null +++ b/AtCoder/ABC_400/C.py @@ -0,0 +1,20 @@ +import math + +N = int(input()) + +count = 0 +e = 1 + +while True: + t = 1 << e + if t > N: + break + Q = N // t + if Q == 0: + e += 1 + continue + m = math.isqrt(Q) + cnt += (m + 1) // 2 + e += 1 + +print(cnt) \ No newline at end of file diff --git a/AtCoder/ABC_400/D.cpp b/AtCoder/ABC_400/D.cpp new file mode 100644 index 0000000..6b8c12a --- /dev/null +++ b/AtCoder/ABC_400/D.cpp @@ -0,0 +1,67 @@ +#include +#define lo long long +#define LLM LONG_LONG_MAX +#define endl "\n" + +using namespace std; +/* + toothless. #17 + @fredcss_dev +*/ + +const lo INF = 1e9; +const lo dx[] = {1, 0, -1, 0}; +const lo dy[] = {0, 1, 0, -1}; + +signed main() { + lo H, W; + cin >> H >> W; + vector g(H); + for (lo i = 0; i < H; ++i) { + cin >> g[i]; + } + + lo A, B, C, D; + cin >> A >> B >> C >> D; + --A, --B, --C, --D; + + vector> dist(H, vector(W, INF)); + deque> q; + dist[A][B] = 0; + q.epb(A, B); + + while (!q.empty()) { + auto [x, y] = q.front(); + q.pop_front(); + if (x == C && y == D) { + cout << dist[x][y] << '\n'; + return 0; + } + + for (lo i = 0; i < 4; ++i) { + lo nx = x + dx[i]; + lo ny = y + dy[i]; + if (nx < 0 || nx >= H || ny < 0 || ny >= W) continue; + if (g[nx][ny] == '.') { + if (dist[nx][ny] > dist[x][y]) { + dist[nx][ny] = dist[x][y]; + q.epf(nx, ny); + } + } else { + for (lo j = 1; j <= 2; ++j) { + lo tx = x + j * dx[i]; + lo ty = y + j * dy[i]; + if (tx < 0 || tx >= H || ty < 0 || ty >= W) break; + if (g[tx][ty] == '.') break; + if (dist[tx][ty] > dist[x][y] + 1) { + dist[tx][ty] = dist[x][y] + 1; + q.epb(tx, ty); + } + } + } + } + } + + cout << -1 << '\n'; + return 0; +} \ No newline at end of file diff --git a/AtCoder/ABC_400/__pycache__/C.cpython-313.pyc b/AtCoder/ABC_400/__pycache__/C.cpython-313.pyc new file mode 100644 index 0000000..15f12d4 Binary files /dev/null and b/AtCoder/ABC_400/__pycache__/C.cpython-313.pyc differ