結果
問題 |
No.1457 ツブ消ししとるなHard
|
ユーザー |
![]() |
提出日時 | 2022-10-13 23:15:06 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 766 bytes |
コンパイル時間 | 328 ms |
コンパイル使用メモリ | 30,720 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 12:12:51 |
合計ジャッジ時間 | 1,187 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
#include<stdio.h> long long int a[55]; long long int dp[55][3003]; int main() { long long int n, m, x, y, z; scanf("%lld %lld %lld %lld %lld", &n, &m, &x, &y, &z); long long int i, j, k; for (i = 0; i < n; i++) scanf("%lld", &a[i]); for (i = 0; i < n; i++) for (j = 0; j < 3003; j++) dp[i][j] = 0; for (i = j = k = 0; i < n; i++) { if (a[i] >= x) { j++; k += a[i]; } } if (j > m) { printf("Handicapped\n"); return 0; } dp[j][k] = 1; for (i = 0; i < n; i++) { if (a[i] <= y) continue; if (a[i] >= x) continue; for (j = m - 1; j >= 0; j--) for (k = 0; k < 3003; k++) dp[j + 1][k + a[i]] += dp[j][k]; } long long int ans = 0; for (i = 1; i <= m; i++) ans += dp[i][i * z]; printf("%lld\n", ans); return 0; }