結果
| 問題 |
No.2120 場合の数の下8桁
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-04 21:46:38 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 610 bytes |
| コンパイル時間 | 719 ms |
| コンパイル使用メモリ | 75,904 KB |
| 実行使用メモリ | 19,280 KB |
| 最終ジャッジ日時 | 2024-07-18 19:30:54 |
| 合計ジャッジ時間 | 4,002 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 WA * 3 |
コンパイルメッセージ
main.cpp:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-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;
}