Submission #1530332
Source Code Expand
#include <bits/stdc++.h> using namespace std; typedef long longll; int main() { int n; cin >> n; ll res = 0; ll keep = 0; for(int i=0; i<n; i++) { ll a; cin >> a; if(keep==1 && a>0) { res++; a--; } res+= a / 2; keep = a % 2; } cout << res << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | refle |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 303 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:10:2: error: ‘ll’ was not declared in this scope ll res = 0; ^ ./Main.cpp:11:5: error: expected ‘;’ before ‘keep’ ll keep = 0; ^ ./Main.cpp:14:6: error: expected ‘;’ before ‘a’ ll a; ^ ./Main.cpp:15:10: error: ‘a’ was not declared in this scope cin >> a; ^ ./Main.cpp:16:6: error: ‘keep’ was not declared in this scope if(keep==1 && a>0) ^ ./Main.cpp:18:4: error: ‘res’ was not declared in this scope res++; ^ ./Main.cpp:21:3: error: ‘res’ was not declared in this scope res+= a / 2; ^ ./Main.cpp:22:3: error: ‘keep’ was not declared in this scope keep = a % 2; ^ ./Main.cpp:24:10: error: ‘res’ was not declared in this scope cout << res << endl; ^