結果

問題 No.369 足し間違い
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-05-13 23:56:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 208 ms
コンパイル使用メモリ 40,408 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 17:26:49
合計ジャッジ時間 586 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%d", &A[i]);
      |                 ~~~~~^~~~~~~~~~~~~
main.cpp:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%lld" ,&v);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <map>
#include <algorithm>

using namespace std;

int main(void){
	int N;
	int A[100010];
	long long int v;
	long long int sum = 0;
	long long int ans;

	scanf("%d", &N);
	for (int i = 0; i < N; ++i)
	{
		scanf("%d", &A[i]);
	}
	scanf("%lld" ,&v);

	for (int i = 0; i < N; ++i)
	{
		sum += A[i];
	}

	ans = sum - v;
	printf("%lld\n", ans);
}
0