2 条题解
-
0Infinity_ LV 8 @ 2024-08-26 17:19:39
#include<stdio.h> using namespace std; int a[1000100], i = 0; //a[10010]会Runtime Error int f91(int x){ if(x <= 100)return f91(f91(x+11)); return x-10; } int main(){ do scanf("%d", &a[i]); while(a[i++] != 0); for(int ii = 0; ii < i-1; ii++)printf("f91(%d) = %d\n", a[ii], f91(a[ii])); return 0; }
-
02023-11-04 13:42:52@
#include<bits/stdc++.h>
using namespace std;
long long f91(int n)
{
if(n<=100)return f91(f91(n+11));
else return n-10;
}
int a[1000001],i=0;
int main()
{
while(1)
{
cin>>a[++i];
if(a[i]==0)
{
i--;break;
}
}
for(int j=1;j<=i;j++)
{
cout<<"f91("<<a[j]<<") = "<<f91(a[j])<<endl;
}return 0;
}
- 1
信息
- ID
- 1546
- 难度
- 7
- 分类
- (无)
- 标签
- 递交数
- 14
- 已通过
- 11
- 通过率
- 79%
- 被复制
- 3
- 上传者