結果

問題 No.369 足し間違い
ユーザー GeckoCPPSonataGeckoCPPSonata
提出日時 2019-08-31 21:41:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,696 bytes
コンパイル時間 2,205 ms
コンパイル使用メモリ 200,960 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-04 02:31:02
合計ジャッジ時間 3,508 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void no369()':
main.cpp:50:11: warning: 'N' is used uninitialized [-Wuninitialized]
   50 |     vi a(N);
      |           ^
main.cpp:49:9: note: 'N' declared here
   49 |     int N,V,ans;
      |         ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
const char alphabetl[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
const char alphabetu[26] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
const ll MOD = (ll) 1e9 + 7;
const int MAX_INT = 1 << 17;
const ll INFL = 1LL << 60;

const ll MAX_V = 1010;
const ll MAX_E = 2010;
ll V, E;
struct edge {
    ll from, to, cost;
};
edge ES[MAX_E];
ll d[MAX_V];

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define PRINT(n) cout << n << "\n";
#define PRINT2(n, m) cout << n << " " << m << " "<< "\n";

#define REP(i,n)  for(int i=0;i<(int)n;++i)
#define RREP(i,n) for(int i =(int)n;i>0;--i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define FOR(i,a,b)  for(int i=a; i<(int)b; ++i)
#define RFOR(i,a,b) for(int i=a; i>(int)b; --i)
#define REPbit(bit, n)  for(int bit = 0; bit < (int)(1<<n); ++bit)
void no369();
int main() {cin.tie(0); ios::sync_with_stdio(false); no369();}

/********************************/
/** yukicoder No.369           **/
/** by MoonlightSonata         **/
/********************************/

template<typename... Args> auto sum(Args... args)
{
    return (args + ...);
}

void no369(){
    int N,V,ans;
    vi a(N);
    cin >> N;
    REP(i,N) cin >> a[i];
    cin >> V;
    int sum = accumulate(a.begin(), a.end(), 0);
    ans = sum - V;
    PRINT(ans)
}
0