#13844: C++用遞迴


22505031 (今晚打老虎)

學校 : 國立嘉義高級中學
編號 : 68291
來源 : [140.113.236.123]
最後登入時間 :
2024-10-16 22:09:52

#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)

學校 : 國立中央大學
編號 : 27736
來源 : [203.204.218.144]
最後登入時間 :
2025-05-29 22:24:26

 

請問哪裡有遞迴