結果
| 問題 |
No.1238 選抜クラス
|
| コンテスト | |
| ユーザー |
y61mpnl
|
| 提出日時 | 2020-09-26 00:14:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 658 bytes |
| コンパイル時間 | 1,678 ms |
| コンパイル使用メモリ | 192,736 KB |
| 最終ジャッジ日時 | 2025-01-14 21:46:43 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%d %d", &n, &k);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
using ll = int_fast64_t;
const int MOD = 1e9+7;
int main(){
int n, k;
scanf("%d %d", &n, &k);
int a[n];
REP(i, 0, n){
scanf("%d", &a[i]);
a[i] -= k;
}
ll dp[1+n][20200] = {};
dp[0][10100] = 1;
REP(i, 1, 1+n){
REP(j, 0, 20200){
dp[i][j] += dp[i-1][j];
dp[i][j] %= MOD;
if(j<a[i-1] or 20200<=j-a[i-1]) continue;
dp[i][j] += dp[i-1][j-a[i-1]];
dp[i][j] %= MOD;
}
}
ll ans = 0;
REP(i, 10100, 20200) ans += dp[n][i];
printf("%ld\n", ans-1);
return 0;
}
y61mpnl