算法篇——Cantor的数表 - SteveWang - 博客园 (cnblogs.com)
#include <bits/stdc++.h>
using namespace std;
int high(int n)
{
return n*(n+1)/2;
}
int main()
{
int k;
cin>>k;
int n=1;
while(1)
{
if(high(n)>=k)
{
break;
}
n++;
}
int m=high(n);
int w=m-k+1;
if(n%2==0)
{
cout<<n-w+1<<"/"<<w;
}
else{ cout<<w<<"/"<<n-w+1;}
return 0;
}