有假币

 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 }

 

posted @ 2018-03-05 21:14  ouyang_wsgwz  阅读(171)  评论(0编辑  收藏  举报