Code: Select all
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x=1,y=1,elso=1;
while(sc.hasNext()){
int n=sc.nextInt();
int u=n;
int q=1;
while(n-q>0){
n-=q;
q++;
}
if(q%2==0) {
x=1;
y=q;
for(int i=1;i<n;i++){
x++;
y--;
}
}
else{
x=q;
y=1;
for(int i=1;i<n;i++){
y++;
x--;
}
}
if(elso==0) System.out.println();
else elso=0;
System.out.print("TERM " + u + " IS " + x+"/"+y);
}
sc.close();
}
}