結果
| 問題 |
No.1327 グラフの数え上げ
|
| コンテスト | |
| ユーザー |
tko919
|
| 提出日時 | 2020-12-24 11:17:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 203 ms / 2,000 ms |
| コード長 | 895 bytes |
| コンパイル時間 | 1,660 ms |
| コンパイル使用メモリ | 167,276 KB |
| 実行使用メモリ | 18,780 KB |
| 最終ジャッジ日時 | 2024-09-21 16:50:53 |
| 合計ジャッジ時間 | 2,515 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 13 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end
const int mod=1000000007;
const int d=100000000;
int pre[]={
1,
927880474,
933245637,
668123525,
429277690,
733333339,
724464507,
957939114,
203191898,
586445753,
698611116};
int main(){
string n; cin>>n;
if(n.size()>10 or (n.size()==10&&n>"1000000007"))puts("0");
else{
ll m=stoi(n)-1,res=pre[m/d];
rep(x,m/d*d+1,m+1)res=(1LL*res*x)%mod;
if(m%2==1)res=(mod-res)%mod;
cout<<res<<endl;
}
return 0;
}
tko919