Submission #1381008
Source Code Expand
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() class Prime(): def __init__(self, n): self.M = m = int(math.sqrt(n)) + 10 self.A = a = [True] * m a[0] = a[1] = False self.T = t = [] for i in range(2, int(math.sqrt(m)) + 1): if not a[i]: continue t.append(i) for j in range(i*i,m,i): a[j] = False def is_prime(self, n): return self.A[n] def division(self, n): d = collections.defaultdict(int) for c in self.T: while n % c == 0: d[c] += 1 n //= c if n < 2: break if n > 1: d[n] += 1 return d.items() def sowa(self, n): r = 1 for k,v in self.division(n): t = 1 for i in range(1,v+1): t += math.pow(k, i) r *= t return r def main(): N = I() pr = Prime(N**2) if pr.is_prime(N): return 'YES' return 'NO' print(main())
Submission Info
Submission Time | |
---|---|
Task | A - 素数、コンテスト、素数 |
User | iehn |
Language | Python (3.4.3) |
Score | 100 |
Code Size | 1612 Byte |
Status | AC |
Exec Time | 143 ms |
Memory | 13264 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 100 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | AC | 80 ms | 7880 KB |
00_sample_02.txt | AC | 42 ms | 5452 KB |
00_sample_03.txt | AC | 139 ms | 13260 KB |
00_sample_04.txt | AC | 109 ms | 10704 KB |
01_test_01.txt | AC | 41 ms | 5456 KB |
01_test_02.txt | AC | 41 ms | 5460 KB |
01_test_03.txt | AC | 137 ms | 12748 KB |
01_test_04.txt | AC | 141 ms | 13260 KB |
01_test_05.txt | AC | 42 ms | 5452 KB |
01_test_06.txt | AC | 41 ms | 5456 KB |
01_test_07.txt | AC | 42 ms | 5460 KB |
01_test_08.txt | AC | 42 ms | 5452 KB |
01_test_09.txt | AC | 42 ms | 5452 KB |
01_test_10.txt | AC | 143 ms | 13260 KB |
01_test_11.txt | AC | 42 ms | 5452 KB |
01_test_12.txt | AC | 57 ms | 6732 KB |
01_test_13.txt | AC | 42 ms | 5452 KB |
01_test_14.txt | AC | 131 ms | 12492 KB |
01_test_15.txt | AC | 72 ms | 7884 KB |
01_test_16.txt | AC | 43 ms | 5452 KB |
01_test_17.txt | AC | 60 ms | 6860 KB |
01_test_18.txt | AC | 118 ms | 11604 KB |
01_test_19.txt | AC | 91 ms | 9548 KB |
01_test_20.txt | AC | 137 ms | 13136 KB |
01_test_21.txt | AC | 41 ms | 5456 KB |
01_test_22.txt | AC | 53 ms | 6476 KB |
01_test_23.txt | AC | 44 ms | 5588 KB |
01_test_24.txt | AC | 140 ms | 13264 KB |
01_test_25.txt | AC | 45 ms | 5716 KB |