結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー 👑 potato167potato167
提出日時 2022-02-17 01:07:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 693 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 78,872 KB
最終ジャッジ日時 2023-09-11 17:20:23
合計ジャッジ時間 5,127 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,168 KB
testcase_01 AC 69 ms
71,064 KB
testcase_02 AC 84 ms
76,396 KB
testcase_03 AC 71 ms
71,108 KB
testcase_04 AC 71 ms
71,036 KB
testcase_05 AC 70 ms
71,076 KB
testcase_06 WA -
testcase_07 AC 70 ms
71,052 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 70 ms
71,068 KB
testcase_11 AC 70 ms
71,140 KB
testcase_12 AC 77 ms
75,972 KB
testcase_13 AC 78 ms
75,688 KB
testcase_14 AC 80 ms
75,784 KB
testcase_15 AC 79 ms
75,736 KB
testcase_16 WA -
testcase_17 AC 81 ms
76,400 KB
testcase_18 AC 81 ms
76,052 KB
testcase_19 AC 83 ms
76,264 KB
testcase_20 AC 85 ms
76,260 KB
testcase_21 AC 83 ms
76,328 KB
testcase_22 AC 85 ms
76,292 KB
testcase_23 WA -
testcase_24 AC 83 ms
76,308 KB
testcase_25 WA -
testcase_26 AC 83 ms
76,204 KB
testcase_27 AC 85 ms
76,328 KB
testcase_28 WA -
testcase_29 AC 86 ms
76,420 KB
testcase_30 AC 98 ms
77,008 KB
testcase_31 AC 92 ms
76,472 KB
testcase_32 AC 122 ms
77,468 KB
testcase_33 AC 117 ms
77,944 KB
testcase_34 AC 132 ms
78,796 KB
testcase_35 AC 128 ms
78,752 KB
testcase_36 AC 135 ms
78,872 KB
testcase_37 AC 121 ms
78,700 KB
testcase_38 AC 113 ms
78,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
N=len(S)
dp=[[0 for i in range(9)] for j in range(N+1)]
MOD=10**9+7
q=[0,0,1,0,2,3,1,0,2,0]
A=0
B=0
J=0
for i in range(N):
	for k in range(ord(S[i])-ord('0')):
		a=A
		b=B
		if q[k]==3:
			if b!=2:
				b+=1
		else:
			a+=q[k]
			if a>2:
				a=2
		if k!=0 and J==0:
			dp[i+1][a+b*3]+=1
	if S[i]=='5':
		B=min(2,B+1)
	elif S[i]=='0':
		J=1
	else:
		A=min(A+q[ord(S[i])-ord('0')],2)
	if i==0:
		continue
	for j in range(9):
		dp[i][j]%=MOD
		if dp[i][j]==0:
			continue
		for k in range(1,10):
			a=j%3
			b=j//3
			if q[k]==3 and b!=2:
				b+=1
			elif q[k]!=3:
				a+=q[k]
				if a>2:
					a=2
			dp[i+1][a+b*3]+=dp[i][j]
	for j in range(9):
		dp[i+1][q[j+1]]+=1

print(dp[N][8]%MOD)
0