結果
問題 | No.1747 Many Formulae 2 |
ユーザー | titia |
提出日時 | 2021-11-19 21:37:53 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 789 bytes |
コンパイル時間 | 231 ms |
コンパイル使用メモリ | 10,920 KB |
実行使用メモリ | 48,128 KB |
最終ジャッジ日時 | 2023-08-30 07:43:02 |
合計ジャッジ時間 | 15,502 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 478 ms
48,128 KB |
testcase_01 | AC | 575 ms
48,028 KB |
testcase_02 | AC | 459 ms
47,912 KB |
testcase_03 | AC | 455 ms
48,056 KB |
testcase_04 | AC | 971 ms
48,068 KB |
testcase_05 | AC | 436 ms
48,012 KB |
testcase_06 | AC | 458 ms
47,916 KB |
testcase_07 | AC | 1,401 ms
47,932 KB |
testcase_08 | AC | 475 ms
47,976 KB |
testcase_09 | AC | 498 ms
47,912 KB |
testcase_10 | AC | 420 ms
47,904 KB |
testcase_11 | AC | 420 ms
47,920 KB |
testcase_12 | AC | 527 ms
48,116 KB |
testcase_13 | AC | 461 ms
48,004 KB |
testcase_14 | AC | 447 ms
47,924 KB |
testcase_15 | TLE | - |
testcase_16 | AC | 1,574 ms
47,920 KB |
testcase_17 | AC | 456 ms
48,116 KB |
testcase_18 | AC | 451 ms
47,932 KB |
ソースコード
import sys input = sys.stdin.readline S=input().strip() def calc(S): #print("!",S) if len(S)==0: yield 0 for i in range(1,len(S)+1): x=int(S[:i]) #print("?",x,S[i:],list(calc(S[i:]))) for j in calc(S[i:]): yield x+j import math x=10**6 L=math.floor(math.sqrt(x)) # 平方根を求める Primelist=[i for i in range(x+1)] Primelist[1]=0 # 1は素数でないので0にする. for i in Primelist: if i>L: break if i==0: continue for j in range(2*i,x+1,i): Primelist[j]=0 Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0] ANS=0 for j in calc(S): if j==1: continue for k in Primes: if j!=k and j%k==0: break else: ANS+=1 print(ANS)