n!+(n+1)!+..........+2!+1! 算法
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
int n = 5;
int i, result = 0;
for (i = n ; i >= 1; --i)
result = (result + 1)*i;
cout << result << endl;
return 0;
}
==================
呵呵CSDN的飞雪贴的代码,感觉很是精妙.
阅读(2180) | 评论(0) | 转发(0) |