输入
7
输出
1/4
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std
;
int main
(){
int n
,i
,j
,k
;
scanf
("%d",&n
);
int an
,an1
=0;
for (i
= 1;an1
<= n
;i
++) {
an
=(i
*(i
-1)/2)+1;
an1
=(i
*(i
+1)/2)+1;
}
for (j
= an
;j
<= n
;j
++){
if (j
== n
) {
if (i
%2 == 0) printf
("%d/%d",i
-j
+an
-1,j
-an
+1);
else printf
("%d/%d",j
-an
+1,i
-j
+an
-1);
}
}
return 0;
}
转载请注明原文地址: https://lol.8miu.com/read-24158.html