結果
問題 | No.2120 場合の数の下8桁 |
ユーザー | kotatsugame |
提出日時 | 2022-11-04 21:46:38 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 75,556 KB |
実行使用メモリ | 22,920 KB |
最終ジャッジ日時 | 2023-09-26 00:07:27 |
合計ジャッジ時間 | 4,151 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
19,548 KB |
testcase_01 | AC | 110 ms
21,376 KB |
testcase_02 | AC | 116 ms
20,852 KB |
testcase_03 | AC | 112 ms
22,412 KB |
testcase_04 | AC | 111 ms
21,888 KB |
testcase_05 | AC | 111 ms
20,072 KB |
testcase_06 | AC | 114 ms
19,736 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 108 ms
22,428 KB |
testcase_10 | AC | 106 ms
20,268 KB |
testcase_11 | AC | 108 ms
19,444 KB |
testcase_12 | AC | 107 ms
19,928 KB |
testcase_13 | AC | 106 ms
20,888 KB |
testcase_14 | AC | 106 ms
21,032 KB |
testcase_15 | AC | 107 ms
21,312 KB |
testcase_16 | AC | 110 ms
21,284 KB |
testcase_17 | AC | 110 ms
21,632 KB |
testcase_18 | WA | - |
testcase_19 | AC | 111 ms
20,024 KB |
コンパイルメッセージ
main.cpp:21:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type] 21 | main() | ^~~~
ソースコード
#include<iostream> #include<iomanip> #include<vector> using namespace std; const int LIM=1e7; bool isp[LIM+1]; vector<int>ps; vector<int>val; void f(int N,int coef) { for(int i=0;i<ps.size();i++) { int n=N,c=0; while(n>=ps[i]) { c+=n/=ps[i]; } val[i]+=c*coef; } } main() { for(int i=2;i<=LIM;i++)if(!isp[i]) { ps.push_back(i); val.push_back(0); for(int j=i+i;j<=LIM;j+=i)isp[j]=true; } int M,N;cin>>M>>N; f(M,1); f(N,-1); f(M-N,-1); long long ans=1; for(int i=0;i<ps.size();i++) { for(int j=0;j<val[i];j++)ans=ans*ps[i]%(int)1e8; } cout<<setw(8)<<setfill('0')<<ans<<endl; }