'commit'
This commit is contained in:
22
TangDou/XiTi/1319.cpp
Normal file
22
TangDou/XiTi/1319.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
int sum = 0;
|
||||
int pre = 0;
|
||||
while (cin >> n) {
|
||||
if (n == 0) break;
|
||||
if (n == 1) {
|
||||
sum++;
|
||||
pre = 0;
|
||||
}
|
||||
if (n == 2) {
|
||||
pre += 2;
|
||||
sum += pre;
|
||||
}
|
||||
}
|
||||
cout << sum << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user