#13844: C++用遞迴


22505031 (今晚打老虎)

學校 : 國立嘉義高級中學
編號 : 68291
來源 : [140.114.208.97]
最後登入時間 :
2022-03-27 20:03:18
a042. 平面圓形切割 -- 許介彥 | From: [114.47.227.11] | 發表日期 : 2018-05-07 22:15

#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]
最後登入時間 :
2024-02-07 22:53:10
a042. 平面圓形切割 -- 許介彥 | From: [140.115.204.235] | 發表日期 : 2018-05-07 23:10

 

請問哪裡有遞迴


 
ZeroJudge Forum