Refactored all solutions

This commit is contained in:
rshaghoulian
2017-04-05 18:42:35 -05:00
parent 5f4c2f4a78
commit decc8e791e
135 changed files with 848 additions and 849 deletions
@@ -7,15 +7,13 @@ import java.text.NumberFormat;
import java.util.Locale;
public class Solution {
public static void main(String[] args) {
/* Read input */
Scanner scanner = new Scanner(System.in);
/* Save input */
Scanner scan = new Scanner(System.in);
double payment = scanner.nextDouble();
scanner.close();
scan.close();
/* Create custom Locale for India.
I used the "IANA Language Subtag Registry" to find India's country code */
/* Create custom Locale for India - I used the "IANA Language Subtag Registry" to find India's country code */
Locale indiaLocale = new Locale("en", "IN");
/* Create NumberFormats using Locales */
@@ -4,12 +4,10 @@
import java.util.Scanner;
class Solution{
public static void main(String []args) {
class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for (int i = 0; i < t; i++) {
try {
long x = scan.nextLong();
@@ -26,8 +24,8 @@ class Solution{
if (x >= Long.MIN_VALUE && x <= Long.MAX_VALUE) {
System.out.println("* long");
}
} catch(Exception e) {
System.out.println(scan.next() +" can't be fitted anywhere.");
} catch (Exception e) {
System.out.println(scan.next() + " can't be fitted anywhere.");
}
}
scan.close();
@@ -5,7 +5,6 @@
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int i = 1;
@@ -5,14 +5,13 @@
import java.util.Scanner;
class Solution{
public static void main(String []args) {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t = scan.nextInt();
for (int i = 0; i < t; i++) {
int a = scan.nextInt();
int b = scan.nextInt();
int n = scan.nextInt();
for (int j = 0; j < n; j++) {
a += b * (int) Math.pow(2, j);
System.out.print(a + " ");
@@ -5,16 +5,15 @@
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("================================");
for (int i = 0; i < 3; i++) {
String s1 = scan.next();
int x = scan.nextInt();
System.out.format("%-15s%03d%n", s1, x);
}
System.out.println("================================");
scan.close();
Scanner scan = new Scanner(System.in);
System.out.println("================================");
for (int i = 0; i < 3; i++) {
String s1 = scan.next();
int x = scan.nextInt();
System.out.format("%-15s%03d%n", s1, x);
}
scan.close();
System.out.println("================================");
}
}