样例没过,但交上去直接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