Skip to content

Commit fb69e0d

Browse files
author
IsHYuhi
committed
ARC44-ARC51
1 parent 2aedf37 commit fb69e0d

File tree

8 files changed

+94
-0
lines changed

8 files changed

+94
-0
lines changed

ARC/ARC044/A.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
n = int(input())
2+
3+
def is_prime(n):
4+
if n == 1:
5+
return False
6+
7+
if n == 2:
8+
return True
9+
10+
for i in range(2, int(n**0.5)+1):
11+
if n%i == 0:
12+
return False
13+
14+
return True
15+
16+
if n==1:
17+
print('Not Prime')
18+
exit()
19+
20+
if ( str(n)[-1]!='5' and (n%10)%2!=0 and sum(list(map(int, list(str(n)))))%3 != 0 ) or is_prime(n):
21+
print('Prime')
22+
else:
23+
print('Not Prime')

ARC/ARC045/A.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
s = input().split()
2+
ans = []
3+
for p in s:
4+
if p == 'Left':
5+
ans.append('<')
6+
elif p == 'Right':
7+
ans.append('>')
8+
else:
9+
ans.append('A')
10+
11+
print(' '.join(ans))

ARC/ARC046/A.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
n = int(input())
2+
3+
cons = []
4+
i = 1
5+
d = 1
6+
while i <= 50:
7+
for j in range(1, 10):
8+
cons.append(str(j)*d)
9+
i += 1
10+
d += 1
11+
12+
print(cons[n-1])

ARC/ARC047/A.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
n, l = map(int, input().split())
2+
s = list(input())
3+
count = 1
4+
ans = 0
5+
for h in s:
6+
if h == '+':
7+
count += 1
8+
elif h == '-' and count >= 1:
9+
count -= 1
10+
11+
if count > l:
12+
count = 1
13+
ans += 1
14+
15+
print(ans)

ARC/ARC048/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
a, b = map(int, input().split())
2+
3+
if a<0 and b>0:
4+
print(b-a-1)
5+
else:
6+
print(b-a)

ARC/ARC049/A.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
s = list(input())
2+
abcd = list(map(int, input().split()))
3+
4+
for i, idx in enumerate(abcd):
5+
s.insert(idx+i, '"')
6+
7+
print(''.join(s))

ARC/ARC050/A.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
C, c = input().split()
2+
3+
if C == c.upper():
4+
print('Yes')
5+
else:
6+
print('No')

ARC/ARC051/A.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
x1, y1, r = map(int, input().split())
2+
x2, y2, x3, y3 = map(int, input().split())
3+
4+
if x1+r<=x3 and x1-r>=x2 and y1+r<=y3 and y1-r>=y2:
5+
print('NO')
6+
print('YES')
7+
8+
elif (x2-x1)**2+(y2-y1)**2 <= r**2 and (x3-x1)**2+(y3-y1)**2 <= r**2 and (x2-x1)**2+(y3-y1)**2 <= r**2 and (x3-x1)**2+(y2-y1)**2 <= r**2:
9+
print('YES')
10+
print('NO')
11+
12+
else:
13+
print('YES')
14+
print('YES')

0 commit comments

Comments
 (0)