提出 #74600360
ソースコード 拡げる
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <bitset>
#include <numeric>
using namespace std;
#define ll long long
#define vi vector<int>
#define vs vector<string>
#define vb vector<bool>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define rep(i, c, n) for (int i = c; i < n; i++)
const long long llINF = 1LL << 60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
/*
* int型でinfを使うならINT_MAX使う
* カウント変数の初期化忘れない
* 制約ちゃんと見る、オーバーフロー気を付ける
* int最大値: 10^9 ll最大値: 10^18
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vi input(n);
int ans = 0;
rep(i, 0, n-1 ) {
cin >> input[i];
ans += input[i];
}
int answer = ans * -1;
cout << answer << "\n";
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Zero Sum Game |
| ユーザ | kar1neko |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 100 |
| コード長 | 1168 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 3672 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_01.txt | AC | 1 ms | 3644 KiB |
| 00_sample_02.txt | AC | 1 ms | 3604 KiB |
| 00_sample_03.txt | AC | 1 ms | 3616 KiB |
| 01_test_01.txt | AC | 1 ms | 3644 KiB |
| 01_test_02.txt | AC | 1 ms | 3672 KiB |
| 01_test_03.txt | AC | 1 ms | 3548 KiB |
| 01_test_04.txt | AC | 1 ms | 3616 KiB |
| 01_test_05.txt | AC | 1 ms | 3600 KiB |
| 01_test_06.txt | AC | 1 ms | 3536 KiB |
| 01_test_07.txt | AC | 1 ms | 3480 KiB |