전체 글
1978
n = int(input()) a=input().split() result=[] def f(n): found = True if n < 2: return -1 elif n == 2: return n else: for i in range(2,int(n/2)+1): if n%i==0: found = False if found: return n else: return -1 for i in range(n): if f(int(a[i]))!= -1: result.append(a[i]) print(len(result))
2839
n = int(input()) x=y=0 y = n//5 found = False while y>=0: q = n-y*5 if q%3==0: x = q//3 found = True break else: y-=1 if found: print(x+y) else: print(-1)
2775
t = int(input()) """ def f(k,n): if k==0: return n else: temp=0 for i in range(1,n+1): temp+=f(k-1,i) return temp for i in range(t): k = int(input()) n = int(input()) print(f(k,n)) """ for i in range(t): k = int(input()) n = int(input()) lists = [i for i in range(1,n+1)] for a in range(k): for b in range(1,n): lists[b]+=lists[b-1] print(lists[n-1]) //재귀 사용하는 방법이랑 list를 이용한 방법 두 가지 시간은 list의 경우가 ..
10250
t = int(input()) for i in range(t): h,w,n=map(int,input().split()) x=1 y=1 p = n//h q = n%h if q==0: if p
2869
import math a,b,v = map(int, input().split()) day = (v-b)/(a-b) if a-b!=1: day= math.ceil(day) else: day=int(day) print(day)
1193
input_num = int(input()) line = 0 max_num = 0 while input_num > max_num: line += 1 max_num += line gap = max_num - input_num if line % 2 == 0: top = line - gap under = gap + 1 else : top = gap + 1 under = line - gap print("%d/%d"%(top,under)) 시간 초과로 못풀었던 문제....
4673
temp = [i for i in range(1,10001)] for i in range(1,10000): result = 0 result +=i for j in str(i): result+=int(j) if result in temp: temp.remove(result) for num in temp: print(num)
1712
import math a,b,c = map(int,input().split()) if b < c: temp = c-b print(math.floor(a/temp + 1))else: print(-1)