結果
| 問題 |
No.645 Count Permutation
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-01-29 12:26:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 2,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 1,938 ms |
| コンパイル使用メモリ | 193,504 KB |
| 実行使用メモリ | 29,056 KB |
| 最終ジャッジ日時 | 2025-01-29 12:26:27 |
| 合計ジャッジ時間 | 3,922 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%lld%lld",&n,&l,&r);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int f[100005][65];
int main(){
int n;long long l,r;
scanf("%d%lld%lld",&n,&l,&r);
int ans=0;
if(l==0){
int cj=n-1;
for(int i=1;i<=n-1;++i)cj=1ll*cj*i%mod;
ans=(ans+cj)%mod;++l;
}
--n;
f[0][0]=1;
for(int i=0;i<n;++i)for(int j=0;j<=60;++j){
f[i+1][j]=(f[i+1][j]+1ll*i*f[i][j])%mod;
f[i+1][j+1]=(f[i+1][j+1]+f[i][j])%mod;
}
for(int i=0;i<60;++i)if((1ll<<i)>=l&&(1ll<<i)<=r){
ans=(ans+f[n][i])%mod;
}
printf("%d\n",ans);
return 0;
}
vjudge1