結果
| 問題 | No.93 ペガサス |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-09-06 10:10:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 489 bytes |
| 記録 | |
| コンパイル時間 | 1,577 ms |
| コンパイル使用メモリ | 161,568 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-06 10:10:05 |
| 合計ジャッジ時間 | 2,716 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 4 |
| other | WA * 16 |
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
const int N=1010;
int n,fac[N];
signed main(){
ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
fac[0]=1;
for(int i=1;i<N;++i)fac[i]=fac[i-1]*i%mod;
cin>>n;
int ans=0;
for(int i=0;i<=n;++i){
int F=(n-i+1)*max(0ll,n-2*i+2)%mod*fac[n-i]%mod;
if(!i)F=fac[n];
if(i&1)ans=(ans-F+mod)%mod;
else ans=(ans+F)%mod;
}
cout<<ans;
return 0;
}
vjudge1