題目連結: https://zerojudge.tw/ShowProblem?problemid=c002
# 解題思路
依照題目的意思寫出函式判斷就好啦~~
# 程式碼
#include<iostream> | |
using namespace std; | |
int f91(int n) | |
{ | |
if(n<=100) | |
return f91(f91(n+11)); | |
if(n>=101) | |
return n-10; | |
} | |
int main() | |
{ | |
int n; | |
while(cin>>n&&n) | |
{ | |
cout<<"f91("<<n<<") = "<<f91(n)<<endl; | |
} | |
} |