#13844: C++用遞迴


22505031 (今晚打老虎)


#include <iostream>
#include <cstring>
#include <sstream>
#include <cmath>
#include <string>
#include<cstdio>
using namespace std;
long long int f(int a)
{
	
  	if(a==1)
  		return 2;
  	else if(a==2)
  		return 4;
  	else
  		return (a-1)*a+2;
  
}
int main()
{
    int x=10000;
    while(!0)
    {
cin>>x cout<<f(x)<<endl; } return 0; }
#13846: Re:C++用遞迴


anandrewboy70900 (ShowTsai)


 

請問哪裡有遞迴