| Task: | Stand on Zanzibar |
| Sender: | Qianyun Guo |
| Submission time: | 2017-10-17 17:12:20 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | ACCEPTED |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.04 s | details |
Code
#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
cin >> n;
while (n--) {
int s = 0;
int t;
int p = 1;
while (cin >> t) {
if (t == 0) break;
if (t > p * 2)
s += t - p*2;
p = t;
}
cout << s << endl;
}
return 0;
}
