有假币

 1 #include <iostream>
 2 #include <algorithm>
 3 using namespace std;
 4 
 5 int main(){
 6     long long n;
 7     while (cin >> n){
 8         if (n == 0)
 9             break;
10         if (n == 1){
11             cout << "0" << endl;
12             continue;
13         }
14         int ans = 0;
15         while (n > 3){
16             n = (n + 2) / 3;
17             ans++;
18         }
19         ans++;
20         cout << ans << endl;
21     }
22     return 0;
23 }
原文地址:https://www.cnblogs.com/ouyang_wsgwz/p/8511415.html