1. Problem
2. My Solution
import sys
arr = []
for i in range(9):
arr.append(int(sys.stdin.readline().strip()))
max = arr[0]
count = 0
index = 0
for i in range(1,9):
count += 1
if arr[i] > max:
max = arr[i]
index = count
print(max)
print(index+1)
3. Others' Solutions
import sys
arr = []
for i in range(9):
arr.append(int(sys.stdin.readline().strip()))
print(max(arr))
print(index(max(arr))+1)
4. Learned
1. Problem
2. My Solution
import sys
n = int(sys.stdin.readline().strip())
ox = [sys.stdin.readline().strip() for i in range(n)]
result = []
for i in range(n):
score = 0
count = 1
flag = False
for j in range(len(ox[i])):
if ox[i][j] == 'O' and flag == False:
score = score + 1
flag = True
count += 1
elif ox[i][j] == 'O' and flag == True:
score = score + count
count += 1
else:
flag = False
count = 1
result.append(score)
for i in range(len(result)):
print(result[i])
3. Others' Solutions
import sys
n = int(sys.stdin.readline().strip())
ox = [sys.stdin.readline().strip() for i in range(n)]
result = []
for i in range(n):
score = 0
count = 0
for j in range(len(ox[i])):
if ox[i][j] == 'O':
count += 1
else:
count = 0
score += count
result.append(score)
for i in range(len(result)):
print(result[i])
4. Learned
1. Problem
2. My Solution
def d(n):
new_num = n
str_n = str(n)
for i in range(len(str_n)):
new_num += int(str_n[i])
constructor.add(new_num)
constructor = set()
for i in range(1,10001):
d(i)
for i in sorted(set(range(1,10001))-constructor):
print(i)
3. Learned