結果
問題 |
No.1736 Princess vs. Dragoness
|
ユーザー |
![]() |
提出日時 | 2021-11-18 23:27:18 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 726 bytes |
コンパイル時間 | 1,267 ms |
コンパイル使用メモリ | 27,216 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-07-04 14:06:06 |
合計ジャッジ時間 | 1,895 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &x, &y); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lld", &h[i]); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main() { long long int n, a, b, x, y; scanf("%lld %lld %lld %lld %lld", &n, &a, &b, &x, &y); long long int i; long long int h[3003]; for (i = 0; i < n; i++) scanf("%lld", &h[i]); for (i = 0; i < n; i++) { if (h[i] / x <= a) { a -= h[i] / x; h[i] %= x; } else { h[i] -= x * a; a = 0; } } for (i = 0; i < n - 1; i++) { if (h[i] < h[i + 1]) { h[i] ^= h[i + 1]; h[i + 1] ^= h[i]; h[i] ^= h[i + 1]; if (i > 0) i -= 2; } } for (i = 0; i < n; i++) { if (a > 0) { a--; h[i] -= x; } } long long int sum = 0; for (i = 0; i < n; i++) if (h[i] > 0) sum += h[i]; if (sum > b * y) printf("No\n"); else printf("Yes\n"); return 0; }