import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int[]arr=new int[1000*1000*10+1];
int[]den=new int[1000*1000*10+1];
for(int i=1,counter=0;i<arr.length;i+=2){
for(int j=1;j<2*i;j++){
if(j>i){
arr[counter]=2*i-j;
}else{
arr[counter]=j;
}
counter++;
if(counter>=arr.length){
break;
}
}
if(counter>=arr.length){
break;
}
}
for(int i=2,counter=0;i<den.length;i+=2){
for(int j=1;j<2*i;j++){
if(j>i){
den[counter]=2*i-j;
}else{
den[counter]=j;
}
counter++;
if(counter>=arr.length){
break;
}
}
if(counter>=arr.length){
break;
}
}
String m="";
while((m=br.readLine())!=null){
int n=Integer.parseInt(m);
sb.append(String.format("TERM %d IS %d/%d\n", n,arr[n-1],den[n-1]));
}
System.out.print(sb);
}
}
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int[]arr=new int[1000*1000*10+1];
int[]den=new int[1000*1000*10+1];
for(int i=1,counter=0;i<arr.length;i+=2){
for(int j=1;j<2*i;j++){
if(j>i){
arr[counter]=2*i-j;
}else{
arr[counter]=j;
}
counter++;
if(counter>=arr.length){
break;
}
}
if(counter>=arr.length){
break;
}
}
for(int i=2,counter=0;i<den.length;i+=2){
for(int j=1;j<2*i;j++){
if(j>i){
den[counter]=2*i-j;
}else{
den[counter]=j;
}
counter++;
if(counter>=arr.length){
break;
}
}
if(counter>=arr.length){
break;
}
}
String m="";
while((m=br.readLine())!=null){
int n=Integer.parseInt(m);
sb.append(String.format("TERM %d IS %d/%d\n", n,arr[n-1],den[n-1]));
}
System.out.print(sb);
}
}
No comments:
Post a Comment