結果

問題 No.369 足し間違い
ユーザー srup٩(๑`н´๑)۶
提出日時 2016-05-13 23:56:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 40,520 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 18:36:19
合計ジャッジ時間 845 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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