题解 | #汽水瓶#
汽水瓶
https://www.nowcoder.com/practice/fe298c55694f4ed39e256170ff2c205f
#include <iostream>
using namespace std;
int main() {
int n;
int cn=0;
while(cin >> n && n != 0){
if(n < 2){
cout << cn << endl;
}else if(n == 2){
cn++;
cout << cn << endl;
}else{
while(n >= 3){
n = n - 3;
cn ++;
n = n + 1;
}
if(n == 2){
cn++;
}
}
cout << cn << endl;
cn =0;
}
return 0;
}
// 64 位输出请用 printf("%lld")
查看7道真题和解析