挺有趣的

 

#include <iostream>

int foo(const int _n)
{
    return _n + (_n==1? 0:foo(_n-1));
}

using namespace std;
int main()
{
    int n;
    while(cin >> n)
        cout << foo(n) << endl;
}

arrow
arrow
    全站熱搜

    大神(偽) 發表在 痞客邦 留言(0) 人氣()