from sys import stdin
input = stdin.readline
n, m = map(int, input().split())
if m == 1 or m == 2:
print("NEWBIE!")
elif m<=n:
print("OLDBIE!")
else:
print("TLE!")
from sys import stdin
input = stdin.readline
n = int(input())
m = str(bin(n))
if n>=0:
print(len(m)-2)
else:
print(32)
from sys import stdin
input = stdin.readline
N = int(input())
t = [1]*66
for i in range(64):
for j in range(65):
t[j] *= 2
if i==j:
t[j] -= 1
for i in range(65):
if t[i] == N:
print(i+1)
from sys import stdin
from math import floor
input = stdin.readline
h, y = map(int, input().split())
r = [h, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for i in range(1, y + 1):
r[i] = max(r[i], floor(r[i - 1] * 1.05))
if i >= 3:
r[i] = max(r[i], floor(r[i - 3] * 1.20))
if i >= 5:
r[i] = max(r[i], floor(r[i - 5] * 1.35))
print(r[y])
from sys import stdin
input = stdin.readline
good = True
content = input().rstrip()
space = int(input())
key = list(map(int, input().split()))
title = ""
for c in content.split():
title += c[0].upper()
content += title
if key[ord(content[0].upper()) - 65] >= 1:
key[ord(content[0].upper()) - 65] -= 1
else:
good = False
for i, c in enumerate(content):
if not good: break
if i == 0: continue
if c == " ":
if content[i-1] == " ":
continue
if space >= 1:
space -= 1
else:
good = False
continue
if content[i-1]==content[i]: continue
if key[ord(c.upper()) - 65] >= 1:
key[ord(c.upper()) - 65] -= 1
else:
good = False
if good:
print(title)
else:
print(-1)
E 음유시인 영재
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tup;
ll res, t;
int s[10];
int yj[10];
void dfs(int depth) {
if (depth == 10) {
res += (t >= 5); return;
}
for (int i = 1; i <= 5; ++i) {
if (depth >= 2 && i == yj[depth - 1] && i == yj[depth - 2]) continue;
yj[depth] = i;
if (i == s[depth]) t++;
dfs(depth + 1);
if (i == s[depth]) t--;
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
for (int i = 0; i < 10; ++i) cin >> s[i];
for (int i = 1; i <= 5; ++i) {
yj[0] = i;
if (i == s[0]) t++;
dfs(1);
if (i == s[0]) t--;
}
cout << res;
return 0;
}
F 영재의 시험
from sys import stdin
from decimal import Decimal as D
input = stdin.readline
x1, y1, z1, x2, y2, z2 = map(D, input().split())
d = ((x2 - x1) ** 2 + (y2 - y1) ** 2 + (z2 - z1) ** 2).sqrt()
N = int(input())
s = list(map(D, input().split()))
M = max(d, max(s))
R = d + sum(s) - M
if M <= R:
print("YES")
else:
print("NO")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tup;
int N, M, z;
ll c[100001];
ll H[100001];
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> N >> M;
for (int i = 0; i < N; ++i) cin >> H[i];
for (int i = 0; i < M; ++i) {
int a, b, k; cin >> a >> b >> k; a--;
c[a] += k; c[b] -= k;
}
for (int i = 0; i < N; ++i) {
z += c[i];
cout << H[i] + z << " ";
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tup;
int R, C;
int O, F, r1, c1, r2, c2;
bool visit[101][101];
int board[101][101];
bool bfs(int row, int col, int f) {
queue<tup> Q;
Q.push({ row, col, f });
while (!Q.empty()) {
int cr, cc, cf;
tie(cr, cc, cf) = Q.front(); Q.pop();
if (cr == r2 && cc == c2) return true;
if (cf == 0) continue;
for (int i = 0; i < 4; ++i) {
int nr = cr, nc = cc, nf = cf;
if (i == 0) nc++; if (i == 1) nc--; if (i == 2) nr++; if (i == 3) nr--;
if (nr <= 0 || nc <= 0 || nr > R || nc > C) continue;
if (board[nr][nc] - board[cr][cc] > nf) continue;
if (visit[nr][nc]) continue;
visit[nr][nc] = true;
Q.push({ nr, nc, nf - 1 });
}
}
return false;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int TEST; cin >> TEST; while (TEST--) {
cin >> R >> C >> O >> F >> r1 >> c1 >> r2 >> c2;
for (int r = 0; r <= R; ++r) for (int c = 0; c <= C; ++c) {
board[r][c] = 0;
visit[r][c] = false;
}
for (int o = 0; o < O; ++o) {
int r, c, l; cin >> r >> c >> l; board[r][c] = l;
}
cout << (bfs(r1, c1, F) ? "잘했어!!" : "인성 문제있어??") << "\n";
}
return 0;
}
from sys import stdin
input = stdin.readline
v, m, t = map(int, input().split())
x, y = 0, 0
d = [0] * 4
for i in range(min(t, 8)):
if i%4 == 0: y += v
if i%4 == 1: x += v
if i%4 == 2: y -= v
if i%4 == 3: x -= v
if i >= 4:
d[i%4] = v
v = (v * m) % 10
if t <= 8:
print(x, y)
else:
u = t - 8 - t%4;
y += (d[0] - d[2]) * u//4
x += (d[1] - d[3]) * u//4
for i in range(t%4):
if i == 0: y += d[0]
if i == 1: x += d[1]
if i == 2: y -= d[2]
print(x, y)
J 영재의 산책
A 1분 (FS) - B 5분 - C 9분 (FS) - D 41분 - E 44분 (FS) - H 113분 - I 118분 (FS) - F 134분 - G 151분 (FS) - J 212분
10문제 풀었다.
너무 많이 틀렸다.. 핑계를 대자면 예제가 전혀 도움이 되질 않았다.
제출 전 검증을 더 하는 습관을 들여야겠다.
'알고리즘 > 대회 참여' 카테고리의 다른 글
shake! 2020 참여 (0) | 2021.01.25 |
---|---|
2020 인하대학교 프로그래밍 경진대회(IUPC) 참여 (0) | 2021.01.10 |
Good Bye, BOJ 2020! 특별상 (0) | 2020.12.31 |
ICPC Seoul Regional 2020 예선 참여 (0) | 2020.10.11 |
2020 ICPC Sinchon Summer Algorithm Camp Contest Open 참여 (0) | 2020.09.06 |
댓글