結果
| 問題 |
No.1417 100の倍数かつ正整数(2)
|
| コンテスト | |
| ユーザー |
zumin
|
| 提出日時 | 2021-03-06 00:09:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 173 ms / 3,000 ms |
| コード長 | 880 bytes |
| コンパイル時間 | 2,632 ms |
| コンパイル使用メモリ | 140,936 KB |
| 実行使用メモリ | 34,944 KB |
| 最終ジャッジ日時 | 2024-10-07 06:29:01 |
| 合計ジャッジ時間 | 5,163 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include <iostream>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint=modint1000000007;
mint dp[10005][100][2][2][2];
int main(){
string s;
cin>>s;
int n=s.length();
dp[0][1][1][0][0]=1;
for(int i=0;i<n;i++){
int curdig=s[i]-'0';
for(int smaller=0;smaller<2;smaller++){
for(int d=0;d<=(smaller?9:curdig);d++){
for(int j=0;j<100;j++){
for(int ldz=0;ldz<2;ldz++){
for(int containz=0;containz<2;containz++){
dp[i+1][d==0?j:(j*d)%100][ldz==1&&d==0][containz || (d==0 && ldz==0)][smaller || d<curdig]+=dp[i][j][ldz][containz][smaller];
}
}
}
}
}
}
cout<<(dp[n][0][0][0][0]+dp[n][0][0][0][1]).val()<<endl;
return 0;
}
zumin