結果
問題 |
No.644 G L C C D M
|
ユーザー |
![]() |
提出日時 | 2018-01-29 09:39:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 343 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 54,492 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 17:58:06 |
合計ジャッジ時間 | 1,662 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; const ll N=100005,mod=1e9+7; ll e[N],n,m,t=0; int main(){ cin>>n>>m; for(int i=0;i<N;i++) e[i]=i; for(int i=2;i<N;i++) if(e[i]==i){ for(int j=i;j<N;j+=i) e[j]=e[j]/i*(i-1); } for(int i=2;i<=n/m;i++) (t+=2*e[i])%=mod; for(int i=1;i<n-1;i++) (t*=i)%=mod; cout<<t<<endl; }