結果

問題 No.2835 Take and Flip
ユーザー tnakao0123
提出日時 2024-08-11 22:22:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 39,808 KB
最終ジャッジ日時 2025-02-23 22:35:46
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:19:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
main.cpp:24:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |     scanf("%d", &ai);
      |     ~~~~~^~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2835.cc:  No.2835 Take and Flip - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* typedef */

using ll = long long;

/* main */

int main() {
  int n;
  scanf("%d", &n);

  ll sum = 0;
  for (int i = 0; i < n; i++) {
    int ai;
    scanf("%d", &ai);
    sum += ai;
  }

  printf("%lld\n", sum);

  return 0;
}
0