解题思路:
注意事项:
参考代码:
#include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<bits/stdc++.h> using namespace std; int n,a[1001],ans[1001]; int cl(int n) { int temp=0; int t=n/3,sheng=n%3; sheng+=t; temp=t; while(sheng>=3) { int t1; t1=sheng/3; sheng=sheng%3+t1; temp+=t1; } if(sheng==2) temp+=1; return temp; } int main() { while(cin>>n) { if(n==0) break; int nas=cl(n); cout<<nas<<endl; } return 0; }
0.0分
0 人评分
多输入输出练习1 (C语言代码)浏览:1189 |
淘淘的名单 (C语言代码)浏览:1104 |
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:557 |
IP判断 (C语言描述,蓝桥杯)浏览:1095 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:547 |
简单的a+b (C语言代码)浏览:419 |
矩形面积交 (C语言代码)浏览:1314 |
陶陶摘苹果2 (C语言代码)浏览:601 |
整除问题 (C语言代码)浏览:526 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:477 |