C++题解
2025-07-25 13:48:09
发布于:上海
3阅读
0回复
0点赞
C++题解
#include <iostream>
using namespace std;
int main(){
int n,m;
cin >> n;
m = n;
while (n >= 3){
m += n/3;
n = n/3+n%3;
}cout << m;
return 0;
}
换成printf:
#include <cstdio>
using namespace std;
int main(){
int n,m;
scanf("%d",&n);
m = n;
while (n >= 3){
m += n/3;
n = n/3+n%3;
}printf("%d",m);
return 0;
}
这里空空如也
有帮助,赞一个