回复:(cilubutong)[求助]C++题目
#include <iostream>
using namespace std;
void compute(int year,int &count){
if (year > 3){
for (;year > 3;--year)
compute(year-3,++count);
return;
}
}
int main(){
int count = 1;
compute(13,count);
cout << count << endl;
return 0;
}
用递归写的,没有算法,个人觉得只是解决了问题,谈不上效率!
希望有更好的答案!


Fight to win or die...