結果

問題 No.146 試験監督(1)
ユーザー sasa
提出日時 2025-03-07 13:22:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 328 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-07 13:22:21
合計ジャッジ時間 1,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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("%lld",&type);
      |         ~~~~~^~~~~~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%lld%lld",&table,&chair);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	long long type = 0;
	scanf("%lld",&type);
	
	long long num = 0;
	for(long long i = 0;i < type;i ++){
		long long chair,table;
		scanf("%lld%lld",&table,&chair);
		
		if((chair % 2) == 0){
			num += chair / 2;
		}else if((chair % 2) == 1){
			num += (chair - 1) / 2;
		}
	}
	printf("%lld",num);
}
0