結果
| 問題 |
No.269 見栄っ張りの募金活動
|
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2015-08-21 22:58:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 5,000 ms |
| コード長 | 1,115 bytes |
| コンパイル時間 | 748 ms |
| コンパイル使用メモリ | 91,380 KB |
| 実行使用メモリ | 20,416 KB |
| 最終ジャッジ日時 | 2024-07-16 01:27:24 |
| 合計ジャッジ時間 | 1,559 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:35:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
35 | scanf("%d%d%d", &n, &s, &k);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
int n;
int s;
int k;
long long int dp[102][20002];
long long int mod[102][20002];
#define MOD 1000000007
int main(){
scanf("%d%d%d", &n, &s, &k);
long long int N = n;
long long int K = k;
long long int kkk = (long long int)(K + N*K-K) *(long long int)(n-1) / 2LL;
if (kkk > (long long int)(s)){
puts("0");
return 0;
}
s -= kkk;
for (int i = 0; i <= s; i++){
if (i*n > s){
break;
}
dp[0][i*n] = 1;
}
for (int i = 0; i+1 < n; i++){
long long int rest = n - i - 1;
for (int j = 0; j <= s; j++){
mod[i][j%rest] += dp[i][j];
mod[i][j%rest] %= MOD;
dp[i + 1][j] = mod[i][j%rest];
}
}
printf("%lld\n", dp[n - 1][s]);
return 0;
}
Kmcode1