Example #1
0
    public void diff(int id, String small, String large) {
      try {
        Scanner sm = new Scanner(new File(small));
        Scanner lg = new Scanner(new File(large));
        int line = 0;
        while (sm.hasNextLine() && lg.hasNextLine()) {
          String s = sm.nextLine();
          String l = lg.nextLine();
          if (!s.equals(l)) {
            System.out.println(line + ">" + s);
            System.out.println(line + "<" + l);
          }
          line++;
        }

      } catch (Exception e) {
        e.printStackTrace();
      }
    }
Example #2
0
 public static void main(String[] args) throws IOException {
   Scanner scanner = new Scanner(new BufferedInputStream(System.in));
   while (scanner.hasNextLine()) {
     String str = scanner.nextLine();
     if (str.equals("0")) break;
     String s[] = str.split(" ");
     int sum = 1;
     for (int i = 0; i < s.length; i += 2)
       sum = sum * (int) Math.pow(Integer.parseInt(s[i]), Integer.parseInt(s[i + 1]));
     Factorization f = new Factorization();
     System.out.println(f.answer(sum - 1));
   }
 }
Example #3
0
 public static void main(String[] args) {
   /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
   Scanner in = new Scanner(System.in);
   String input = "";
   int n = 1;
   String output = "";
   while (in.hasNextLine()) {
     if (in.hasNext()) {
       output += n + " " + in.nextLine() + "\n";
       n++;
     }
   }
   System.out.println(output);
 }