結果

問題 No.369 足し間違い
ユーザー toto
提出日時 2025-03-27 11:17:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 288 bytes
コンパイル時間 462 ms
コンパイル使用メモリ 26,752 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2025-03-27 11:17:57
合計ジャッジ時間 1,091 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&val);
      |         ~~~~~^~~~~~~~~~~
main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d",&tmp);
      |                 ~~~~~^~~~~~~~~~~
main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |         scanf("%lld",&yukians);
      |         ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 項数
	int val = 0;
	scanf("%d",&val);
	// 合計値
	int sum = 0;
	for(int i = 0;i < val;i ++){
		int tmp = 0;
		scanf("%d",&tmp);
		sum += tmp;
	}
	
	// ゆきの解
	long long yukians = 0;
	scanf("%lld",&yukians);
	
	printf("%lld",sum - yukians);
}
0