Skip to content

Commit 222b99a

Browse files
author
IsHYuhi
committed
made ABC
1 parent 4ea2294 commit 222b99a

File tree

48 files changed

+763
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+763
-0
lines changed

ABC/.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"git.ignoreLimitWarning": true
3+
}

ABC/ABC1/A.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
H1 = int(input())
2+
H2 = int(input())
3+
print(H1-H2)

ABC/ABC1/B.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
m = int(input())
2+
#m = m/1000
3+
if m < 100:
4+
c = 0
5+
elif m <= 5000:
6+
c = int(m/100)
7+
elif m <=30000:
8+
c = int((m+50000)/1000)
9+
elif m <=70000:
10+
c = int((m-30000)/5000 + 80)
11+
else:
12+
c = 89
13+
c = str(c)
14+
c = str('0')+c if len(c) <2 else c
15+
16+
print(c)

ABC/ABC103/ABC103D.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from operator import itemgetter
2+
N, M = map(int, input().split())
3+
ab = sorted([tuple(map(int, input().split())) for i in range(M)], key=itemgetter(1))
4+
5+
ans = 0
6+
removed = -1
7+
8+
for a, b in ab:
9+
if a > removed:
10+
removed = b-1
11+
ans += 1
12+
print(ans)

ABC/ABC104/C.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
d, g = map(int, input().split())
2+
pc = [list(map(int, input().split())) for _ in range(d)]
3+
4+
5+
def dfs(i, sum, count, nokori):
6+
global ans
7+
if i == d:#全ての最後の問題セットにたどり着いたら, 全ての葉を確認
8+
if sum < g:
9+
use = max(nokori)#選んでいない種類で最大のスコアの問題を選ぶ
10+
#-(-(g-sum)//(use*100)) <- (g-sum)//(use*100) 199//100 = 0, -199//100 = -1 なので最低超えている数が欲しいときはマイナスに変換する。
11+
n = min(pc[use-1][0], -(-(g-sum)//(use*100)))#その難易度の問題の数 または 残りの必要スコア/その難易度の問題1問の点数 の最小値をとる->余計に問題を解かない&問題数を超えてとかない
12+
print(n, -(-(g-sum)//(use*100)), (g-sum), -(g-sum)//(use*100))
13+
count += n
14+
sum += n * use * 100
15+
16+
if sum >= g:#全ての葉の達成してる最小の答えを記録
17+
ans = min(ans, count)
18+
19+
else:
20+
dfs(i+1, sum, count, nokori)#選ばなかった場合
21+
dfs(i+1, sum + pc[i][0] * (i+1) * 100 + pc[i][1], count + pc[i][0], nokori - {i+1})#全て解いた番号をセットから抜いて、合計&countを更新
22+
23+
ans = float("inf")
24+
dfs(0, 0, 0, set(range(1, d+1)))
25+
print(ans)

ABC/ABC104/test.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# for i in range(100):
2+
# for j in range(100):
3+
# print((i-j)//100, -(-(i-j)//100), i, j)
4+
print(-(200-2)//(2*100))
5+
print((200-2)//(2*100))

ABC/ABC15/A.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
A = input()
2+
B = input()
3+
4+
if len(A)>=len(B):
5+
print(A)
6+
else:
7+
print(B)

ABC/ABC15/B.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import math
2+
N = int(input())
3+
A = list(map(int, input().split()))
4+
5+
print(math.ceil(sum(A)/(N-A.count(0))))

ABC/ABC15/D.py

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# w = int(input())
2+
# n, k = map(int, input().split())
3+
# a = []
4+
# b = []
5+
# for i in range(n):
6+
# a_, b_ = map(int,input().split())
7+
# a.append(a_)
8+
# b.append(b_)
9+
10+
# dp = [[0]*(w+1) for _ in range(n+1)]
11+
12+
# rest = w
13+
14+
# for i in range(n):
15+
# for j in range(w+1):
16+
# if a[i] > j:
17+
# dp[i+1][j] = dp[i][j]
18+
# else:
19+
# dp[i+1][j] = max(dp[i][j], dp[i][j-a[i]]+b[i])
20+
# print(dp[n][w])
21+
22+
23+
24+
25+
26+
27+
28+
#3次元dp MLE
29+
30+
# w = int(input())
31+
# n, k = map(int, input().split())
32+
# a = []
33+
# b = []
34+
# for i in range(n):
35+
# a_, b_ = map(int, input().split())
36+
# a.append(a_)
37+
# b.append(b_)
38+
39+
# dp = [[[0] * (w + 1) for i in range(k + 1)] for j in range(n + 1)]
40+
41+
# # dp[i][j][l] := i 番目まで見て、j 枚使用し、幅が合計 l のときの最大値
42+
# for i in range(n):
43+
# for j in range(k + 1):
44+
# for l in range(w + 1):
45+
# if j == k: # この枚数以上貼れない
46+
# dp[i + 1][j][l] = dp[i][j][l]
47+
# else:
48+
# if l < a[i]: # 幅が足りない
49+
# dp[i + 1][j][l] = dp[i][j][l]
50+
# else:
51+
# dp[i + 1][j][l] = max(dp[i][j][l], dp[i][j - 1][l - a[i]] + b[i])
52+
53+
# # 必ず k 枚使う必要はない
54+
# ans = 0
55+
# for i in range(k + 1):
56+
# ans = max(ans, dp[n][i][w])
57+
58+
# print(ans)
59+
60+
w = int(input())
61+
n, k = map(int, input().split())
62+
63+
dp = [[0] * (w + 1) for i in range(k + 1)]
64+
ans=0
65+
for i in range(n):
66+
a, b = map(int, input().split())
67+
for j in range(k, 0, -1):
68+
for l in range(w, 0, -1):
69+
if 0 <= l-a:
70+
dp[j][l] = max(dp[j][l], dp[j - 1][l - a] + b)
71+
ans = max(dp[j][l], ans)
72+
73+
print(ans)
74+
75+
# w = int(input())
76+
# n, k = map(int, input().split())
77+
# dp = [[0]*(w+1) for i in range(k+1)]
78+
# ans = 0
79+
# for _ in range(n):
80+
# a,b = map(int, input().split())
81+
# for j in range(k, 0, -1):
82+
# for p in range(w, 0, -1):
83+
# if p-a >= 0:
84+
# dp[j][p] =max(dp[j][p], dp[j-1][p-a] + b)
85+
# ans = max(ans, dp[j][p])
86+
87+
# print(ans)

ABC/ABC167/A.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
S = input()
2+
T = input()
3+
4+
if S.islower() and T.islower() and 1<=len(S)<=10 and S == T[:-1]:
5+
print('Yes')
6+
else:
7+
print('No')

ABC/ABC167/B.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
A, B, C, K = map(int, input().split())
2+
3+
if K > A:
4+
K = K-A
5+
if K > B:
6+
K = K-B
7+
if K > C:
8+
print(A-C)
9+
else:
10+
print(A-K)
11+
else:
12+
print(A)
13+
else:
14+
print(K)

ABC/ABC168/A.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
N = input()
2+
m = int(N[-1])
3+
4+
if m == 3:
5+
print('bon')
6+
elif m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
7+
print('hon')
8+
else:
9+
print('pon')

ABC/ABC168/B.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
K = int(input())
2+
S = input()
3+
4+
if len(S)<=K:
5+
print(S)
6+
else:
7+
S = S[:K]+'...'
8+
print(S)

ABC/ABC168/C.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import math
2+
A, B, H, M = map(int, input().split())
3+
4+
ra = H*30 + 0.5*M
5+
rb = M*6
6+
rc = abs(ra-rb)
7+
if rc > 180:
8+
rc = 360 - rc
9+
print(rc)
10+
c2 = A**2 + B**2 - 2*A*B* math.cos(math.radians(rc))#cosのときはradianに直す
11+
print(c2**(0.5))

ABC/ABC171/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
S = input()
2+
3+
if S.islower():
4+
print('a')
5+
else:
6+
print('A')

ABC/ABC171/B.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import itertools
2+
N, K= map(int,input().split())
3+
p = list(map(int, input().split()))
4+
p.sort()
5+
ans = sum(p[:K])
6+
# ans = 1000000
7+
# def dfs(i, sum):
8+
# print(sum)
9+
# global ans
10+
# if i == N-1:
11+
# ans = min(ans, sum)
12+
# return
13+
# dfs(i+1, sum + p[i])
14+
# dfs(i+1, sum)
15+
16+
# dfs(0, 0)
17+
# print(ans)
18+
# ans = 1000000
19+
# for i in itertools.combinations(p, K):
20+
# s = sum(i)
21+
# ans = min(ans, s)
22+
print(ans)

ABC/ABC171/C.py

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
N = int(input())
2+
ans = ''
3+
4+
i = 1
5+
while True:
6+
if N <= 26**i:
7+
N -= 1# a=1なので0に合わせる
8+
for j in range(i):
9+
ans += chr(ord('a') + N%26)# 26の時ord(a)+25
10+
N //= 26
11+
break
12+
else:
13+
N -= 26 ** i
14+
i+=1
15+
print(ans[::-1])
16+
17+
# N = int(input())
18+
# 2 ans = ''
19+
# 3 while N > 0:
20+
# 4 N -= 1
21+
# 5 ans += chr(ord('a') + N % 26)
22+
# 6 N //= 26
23+
# 7 print(ans[::-1])
24+
25+
26+
# l = []
27+
# ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
28+
29+
# i = 0
30+
# pre = 0
31+
# while N>26**i:
32+
# i += 1
33+
# i -= 1
34+
35+
# #l.append((N%26))
36+
# #N -= N%26
37+
# print(i)
38+
# while N>26:
39+
# l.append(N//(26**i)-1)
40+
# N -= (N//26**i)*26**i
41+
# i -= 1
42+
# print(N)
43+
# l.append(N)
44+
# print(l)
45+
# for i in l:
46+
# print(ascii_lowercase[i-1], end='')
47+
# print('')
48+
49+
50+
51+
52+
# while N>26:
53+
# l.append(N%26)
54+
# N = (N//26)
55+
# print(N)
56+
# l.append(N%26)
57+
# print(l[::-1])
58+
# for i in l[::-1]:
59+
# print(ascii_lowercase[i], end='')
60+
# print('')

ABC/ABC171/D.py

Whitespace-only changes.

ABC/ABC171/E.py

Whitespace-only changes.

ABC/ABC2/A.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
X, Y = map(int,input().split())
2+
high = X if X>Y else Y
3+
print(high)

ABC/ABC2/B.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import re
2+
W = input()
3+
#W = W.replace('a','')
4+
print(re.sub('a|i|u|e|o', '', W))

ABC/ABC2/C.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Ax, Ay, Bx, By, Cx, Cy = map(int,input().split())
2+
3+
print(abs(((Ax-Cx)*(By-Cy)-(Bx-Cx)*(Ay-Cy))/2))

ABC/ABC2/D.py

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import itertools
2+
3+
N, M = map(int, input().split())
4+
xy = [[0]*N for i in range(N)]
5+
for i in range(M):
6+
x, y = map(int, input().split())
7+
x -=1
8+
y -=1
9+
xy[x][y] = 1
10+
xy[y][x] = 1
11+
#xy = [list(map(int, input().split())) for i in range(M)]
12+
#print(xy)
13+
14+
ans = 0
15+
16+
def dfs(i, group):
17+
global ans
18+
if i == N:
19+
flag = True
20+
for i in itertools.combinations(group, 2):
21+
if xy[i[0]][i[1]] == 0:
22+
flag = False
23+
break
24+
if flag:
25+
ans = max(ans, len(group))
26+
else:
27+
dfs(i+1, group)
28+
dfs(i+1, group + [i])
29+
30+
31+
dfs(0, [])
32+
print(ans)

ABC/ABC3/A.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
N = int(input())
2+
3+
print(int(((N+1)/2)*10000))

0 commit comments

Comments
 (0)