求助!!!
  • 板块灌水区
  • 楼主eggy__party
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/6/25 11:20
  • 上次更新2024/6/25 14:09:33
查看原帖
求助!!!
1288110
eggy__party楼主2024/6/25 11:20

这题整么做

在我老师OJ上下面的代码通不过。。。

#include<bits/stdc++.h>
using namespace std;
int read() {
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9') {
		if (ch == '-') f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return x * f;
}
int f(int x) {
	if (x <= 100) {
		return f(f(x + 11));
	}
	return x - 10;
}
int main() {
	unsigned long long n = 1;
	while (1) {
		n = read();
		if(n==0){
			break;
		}
		cout << f(n);
	}
	return 0;
}
2024/6/25 11:20
加载中...