結果
問題 |
No.1327 グラフの数え上げ
|
ユーザー |
👑 ![]() |
提出日時 | 2020-12-27 20:14:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 154 ms / 2,000 ms |
コード長 | 680 bytes |
コンパイル時間 | 1,736 ms |
コンパイル使用メモリ | 192,408 KB |
最終ジャッジ日時 | 2025-01-17 07:45:34 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; using LL=long long; using ULL=unsigned long long; #define rep(i,n) for(int i=0; i<(n); i++) const ULL M=1000000007,D=1<<25, T[] = { 1,361946029,117175975,532814826, 638916270,709912685,565479858,534784668, 864357307,580002085,988122582,626052914, 711403642,930569788,928062158,782871805, 373979365,75908005,861919911,973727253, 963971145,892153437,976333508,204474745, 183143523,224645330,885152995,514060757, 894672548,683957845 }; int main(){ ULL x=0; ULL ans=0; char c; while(c=getchar(),'0'<=c&&c<='9'&&x<1<<30) x=x*10+c-'0'; x=min(x-1,M); ans=T[x/D]; rep(i,x%D) ans=M-ans*(x-i)%M; cout<<ans%M<<endl; return 0; }