結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー publflpublfl
提出日時 2021-03-05 21:38:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 856 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 33,920 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-04-16 09:02:31
合計ジャッジ時間 1,413 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 WA -
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 4 ms
5,376 KB
testcase_31 AC 4 ms
5,376 KB
testcase_32 AC 6 ms
5,632 KB
testcase_33 AC 12 ms
8,320 KB
testcase_34 AC 22 ms
12,800 KB
testcase_35 AC 22 ms
13,184 KB
testcase_36 AC 22 ms
13,312 KB
testcase_37 AC 24 ms
13,056 KB
testcase_38 AC 23 ms
13,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#define MOD 1000000007

int gcd(int a, int b)
{
	return a?gcd(b%a,a):b;
}

int a;
char x[10010];
int y[10010];
long long int check[10010][110];
long long int func(int s, int t)
{
	if(s>a)
	{
		if(t==100) return 1;
		else return 0;
	}
	if(check[s][t]!=-1) return check[s][t];
	long long int ans = 0;
	for(int i=1;i<=9;i++) ans += func(s+1,gcd(100,t*i)), ans %= MOD;
	return check[s][t] = ans;
}

int main()
{
	scanf("%s",x+1);
	a = strlen(x+1);
	for(int i=1;i<=a;i++) for(int j=0;j<=100;j++) check[i][j] = -1;
	
	long long int ans = 0;
	for(int i=2;i<=a;i++) ans += func(i,1), ans %= MOD;
	
	for(int i=1;i<=a;i++) y[i] = (x[i]-'0');
	long long int t = 1;
	for(int i=1;i<=a;i++)
	{
		if(y[i]==0) break;
		for(int j=1;j<y[i];j++) ans += func(i+1,gcd(100,t*j)), ans%= MOD;
		t = gcd(100,t*y[i]);
	}
	printf("%lld",ans);
}
0