|
- #include <iostream>
- #include <cstdio>
- #include <cstdlib>
- #include <cmath>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int i,n,j=1,all=0,k;
- scanf("%d",&n);
- for(i=1;;i++)
- {
- j=i%2;
- if(all+i<=n)
- all+=i;
- else
- {
- k=n-all;
- if(k==0)
- k++,i--;
- j++;
- if(j==1)
- {
- printf("%d/%d",k,i+1-k);
- }
- else
- {
- printf("%d/%d",i+1-k,k);
- }
- return 0;
- }
- }
- return 0;
- }
复制代码 |
|