CSP-201803-1-跳一跳
解题代码
#include <iostream>
using namespace std;int score, s, last_s = -1;int main() {while (true){cin >> s;if (s == 0) break;else if (s == 1) {score += s;last_s = s;}else if (s == 2) {if (last_s>=2){score += last_s;last_s += 2;}else{score += s;last_s = s + 2;} }}cout << score;return 0;
}