#include<bits/stdc++.h>
using namespace std;
vector <long long >ar,br;
int main()
{
long long i,j,n,a=1,b=1,c,x;
c=1;
for(i=1; i<=1000000; i++)
{
if(i%2==0)
{
//cout<<"x="<<endl;
a=1;
b=i;
for(j=1; j<=i; j++)
{
ar.push_back(a);
br.push_back(b);
b--;
a++;
//cout<<"A="<<ar[c]<<" "<<br[c]<<" "<<c<<endl;
c++;
}
}
else
{
//cout<<"y="<<endl;
a=i;
b=1;
for(j=1; j<=i; j++)
{
ar.push_back(a);
br.push_back(b);
b++;
a--;
//cout<<"B="<<ar[c]<<" "<<br[c]<<" "<<c<<endl;
c++;
}
}
if(c>10000009)
break;
}
long long count=1;
while(cin>>x)
{
cout<<"TERM "<<x<<" IS "<<ar[x-1]<<"/"<<br[x-1]<<endl;
}
return 0;
}
No comments:
Post a Comment