建议加强数据
查看原帖
建议加强数据
530570
Firrel_qaq楼主2023/7/27 09:48

样例没过,但交上去直接A了

#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int n;
int now = 1,a = 1,b = 1,cnt = 1;
int main(){
	scanf("%d",&n);
	while(1){
		if(cnt == n) break;
		if(b == now){
			++now;
			a = now;
			b = 1;
		}
		else{
			--a;
			++b;
		}
		++cnt;
	}
	printf("%d/%d",a,b);
	return 0;
}

样例输出

4/1 正确输出

1/4

2023/7/27 09:48
加载中...