Dmaxiya

T710749 D. 小灯求石 [Hello World 2026 蓝桥杯选拔赛]

Dec 21st, 2025
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.18 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int n, ans;
  4.  
  5. int main() {
  6.     scanf("%d", &n);
  7.     while (n != 1) {
  8.         ++ans;
  9.         n = (n + 2) / 3;
  10.     }
  11.     printf("%d\n", ans);
  12.  
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment