結果
問題 | No.586 ダブルブッキング |
ユーザー |
![]() |
提出日時 | 2018-05-29 23:13:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 380 bytes |
コンパイル時間 | 130 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:05:14 |
合計ジャッジ時間 | 817 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d%d%d\n", &pay1, &pay2, &N); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &num); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ int pay1, pay2; int N, i, num; int room[1000] = {0}; int money = 0; scanf("%d%d%d\n", &pay1, &pay2, &N); for(i = 0; i < N; i++){ scanf("%d", &num); room[num]++; if(room[num] > 1){ money += pay1 + pay2; room[num]--; } } printf("%d\n", money); return 0; }