Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
5227 | D班-西瓜 | 汽水瓶 | C++ | 通过 | 100 | 1 MS | 256 KB | 315 | 2025-01-24 10:02:56 |
#include <bits/stdc++.h> using namespace std; int main() { int n,cnt,temp; while(1) { cin >> n; if(n==0) { break; } cnt=0; while(n>1) { if(n==2) { cnt++; break; } temp = n/3; cnt += temp; n %= 3; n += temp; } cout << cnt << endl; } return 0; }