結果
| 問題 |
No.573 a^2[i] = a[i]
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-05-17 18:16:32 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 1,439 bytes |
| コンパイル時間 | 5,754 ms |
| コンパイル使用メモリ | 169,804 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-17 18:16:39 |
| 合計ジャッジ時間 | 4,049 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 47 |
ソースコード
/*
??????
??????
??????
??????
D P ????
??????
??????
??????
??????
??? l l?
??????
??????
?? OI ??
??????
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
//#define eps 1e-9
//#define ENF 1e13
inline int read()
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-48;ch=getchar();}
return x*f;
}
void write(int x)
{
if(x<0)putchar('-'),x=-x;
if(x<10)putchar(x+'0');
else write(x/10),putchar(x%10+'0');
}
const int N=3e6;
const int mod=1e9+7;
int ksm(int a,int b){
long long ret=1;
while(b){
if(b&1)(ret*=a)%=mod;
(a*=a)%=mod;
b>>=1;
}
return ret%mod;
}
int n;
int jc[N];
int C(int n,int m){
if(m>n)return 0;
return jc[n]%mod*ksm(jc[m]%mod,mod-2)%mod*ksm(jc[n-m]%mod,mod-2)%mod;
}
int ans;
signed main(){
// freopen("oncemore.in","r",stdin);
// freopen("oncemore.out","w",stdout);
n=read();
jc[0]=1;
for(int i=1;i<=n;i++)jc[i]=jc[i-1]%mod*i%mod;
for(int i=1;i<=n;i++){
(ans+=C(n,i)%mod*ksm(i,n-i)%mod)%=mod;
}
cout<<ans<<"\n";
return 0;
}
// ?????????????AC????
// ?????????????????????????
// ??????????????????
// ????????????????????????????????????
// ???????????????????????????????
// ????????????
// ????????????
// ????????????
// ????????????????????
// ????????????????????
// ????????????????????????????????
// ???????????????????????
// ???????????
// ?????????????
vjudge1