模拟题。。。 #include <iostream> #include <vector> #include <stack> #include <queue> #include <iterator> #include <numeric> #include <string> #include <algorithm> #include <cmath> #include <cstdlib> #include <sstream> using namespace std; int main() { int n; cin>>n; vector<int> v; while(n!=0) { int m1=0,m2=0,m3=0; while(1) { if(n<3) { break; } m1=n/3; m3+=m1; m2=m1+n%3; n=m2; } if(n==2) { m3++; } v.push_back(m3); cin>>n; } copy(v.begin(),v.end(),ostream_iterator<int>(cout,"\n")); return 0; }
解题思路:
注意事项:
参考代码:
0.0分
0 人评分
剔除相关数 (C语言代码)浏览:1836 |
点我有惊喜!你懂得!浏览:1514 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:578 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:620 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:648 |
P1002 (C语言代码)浏览:976 |
【数组的距离】 (C语言代码)浏览:728 |
【亲和数】 (C语言代码)浏览:493 |
A+B for Input-Output Practice (III) (C语言代码)浏览:570 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:765 |