結果

問題 No.146 試験監督(1)
ユーザー sasa
提出日時 2025-03-07 13:09:25
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 8,604 KB
最終ジャッジ日時 2025-03-07 13:09:27
合計ジャッジ時間 2,358 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&type);
      |         ~~~~~^~~~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d%d",&table,&chair);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	int type = 0;
	scanf("%d",&type);
	
	int num = 0;
	for(int i = 0;i < type;i ++){
		int chair,table;
		scanf("%d%d",&table,&chair);
		
		if(table == 2){
			num += chair;
		}else if(table == 3){
			num += chair * 2;
		}
	}
	printf("%d",num);
}
0