전체 글439 백준 4948 파이썬 import mathnumber = [x for x in range(1,246913)]number.insert(0,1)for i in range(2,246913): j=2 while 246912>=i*j: number[i*j]=1 j+=1a=int(input())while a!=0: count=0 for i in range(a+1,2*a+1): if number[i]!=1: count += 1 print(count) a=int(input()) 2018. 9. 13. 백준 1929번 import mathdef isPrime(num): if num 2018. 9. 11. 백준 2581 a = int(input())b= int(input())min=0sum=0key=0for i in range(a,b+1): flag=0 if i > 2: for j in range(2,i): if i%j==0: flag=1 if flag==0: sum=sum+i if key==0: min=i if i ==2: sum=sum+2 if key==0: min=i if min!=0: key=1if min==0: print(-1)else: print(sum) print(min) 2018. 9. 11. 백준 1978 n = int(input())count=0a= list(map(int, input().split()))for i in range(len(a)): flag=0 if a[i] > 2: for j in range(2,a[i]): if a[i]%j==0: flag=1 if flag==0: count+=1 if a[i] ==2: count+=1print(count) 2018. 9. 11. 이전 1 ··· 101 102 103 104 105 106 107 ··· 110 다음