(UVA) Automatic Answer - Solution
import java.io.*;
import java.util.*;
class Main {
public static void process() throws NumberFormatException, IOException {
Scanner sc = new Scanner(System.in);
int numCases = sc.nextInt();
for (int i = 0; i < numCases; i++) {
int num = sc.nextInt();
int result = ((((((num*567)/9)+7492)*235)/47)-498);
String s = String.valueOf(result);
System.out.println(s.charAt(s.length()-2));
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
import java.util.*;
class Main {
public static void process() throws NumberFormatException, IOException {
Scanner sc = new Scanner(System.in);
int numCases = sc.nextInt();
for (int i = 0; i < numCases; i++) {
int num = sc.nextInt();
int result = ((((((num*567)/9)+7492)*235)/47)-498);
String s = String.valueOf(result);
System.out.println(s.charAt(s.length()-2));
}
return;
}
public static void main(String[] args) throws NumberFormatException, IOException {
Main m = new Main();
m.process();
System.exit(0);
}
}
Comments
Post a Comment