結果
問題 | No.573 a^2[i] = a[i] |
ユーザー |
|
提出日時 | 2017-10-09 06:29:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 219 ms / 2,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 494 ms |
コンパイル使用メモリ | 65,664 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 06:18:39 |
合計ジャッジ時間 | 1,939 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 47 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; long M=1e9+7,n,x,fact[1<<17]={1},ans; long pow(long a,long b){return b?pow(a*a%M,b/2)*(b%2?a:1)%M:1;} main() { cin>>n; for(;x++<n;)fact[x]=fact[x-1]*x%M; for(x=0;x++<n;) { ans=(ans+fact[n]*pow(fact[n-x],M-2)%M*pow(fact[x],M-2)%M*pow(x,n-x)%M)%M; } cout<<ans<<endl; }