1 条题解
-
0
C :
#include <stdio.h> int main() { int x,sum; while(scanf("%d",&x)!=EOF) { sum=x; while(x>=3) { sum+=x/3; x=x/3+x%3; } printf("%d\n",sum); } return 0; }
C++ :
# include <iostream> using namespace std; int main() { int n, j = 0, k; while(cin >> n) { int j = 0; k = n; while(n >= 3) { j += n / 3; n = n / 3 + n % 3; } cout << j + k << endl; } return 0; }
- 1
信息
- ID
- 1175
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- (无)
- 递交数
- 0
- 已通过
- 0
- 上传者