Untitled

mail@pastecode.io avatar
unknown
java
a year ago
2.3 kB
1
Indexable
Never
/* Decompiler 15ms, total 303ms, lines 60 */
import java.util.Arrays;
import java.util.PrimitiveIterator.OfInt;
import java.util.Scanner;

public class Flag {
   static int[] primos = new int[]{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199};
   static int[][] flag = new int[][]{{2, 53}, {3, 3, 13}, {2, 7, 7}, {5, 23}, {101}, {2, 61}, {101}, {2, 5, 5}, {2, 7, 7}, {47}, {2, 2, 3, 3, 3}, {3, 37}, {2, 2, 2, 2, 3}, {107}, {3, 17}, {5, 23}, {2, 2, 2, 2, 3}, {47}, {3, 37}, {2, 2, 2, 2, 2, 3}, {101}, {3, 17}, {2, 7, 7}, {5, 23}, {47}, {113}, {2, 2, 2, 2, 3}, {11, 11}, {3, 17}, {5, 23}, {2, 2, 2, 2, 3}, {47}, {3, 37}, {2, 2, 2, 2, 2, 3}, {3, 37}, {113}, {2, 2, 2, 2, 3}, {2, 2, 3, 3, 3}, {2, 5, 5}, {2, 2, 29}, {2, 3, 3, 7}};

   static int[] factorizar(int var0) {
      OfInt var1 = Arrays.stream(primos).iterator();
      int var2 = (Integer)var1.next();
      int[] var3 = new int[0];
      int var4 = 0;

      while(var4 != 1) {
         if (var0 % var2 != 0) {
            var2 = (Integer)var1.next();
         } else {
            var3 = Arrays.copyOf(var3, var3.length + 1);
            var3[var3.length - 1] = var2;
            var0 = var4 = var0 / var2;
         }
      }

      return var3;
   }

   public static void main(String[] var0) {
      Scanner scan = new Scanner(System.in);
      final String line = scan.next();
      //String var1 = System.console().readLine("Introduce la flag: ");
      System.out.println(line.length());


      if (line.length() != flag.length) {
         System.out.println("Noooo.");
         System.exit(0);
      }

      boolean var2 = false;

      for(int var3 = 0; var3 < line.length(); ++var3) {
         char var4 = line.charAt(var3);
         int var6;
         if (var4 % 5 == 0) {
            var6 = var4 + 1;
         } else {
            var6 = var4 - 1;
         }

         int[] var5 = factorizar(var6);
         if (!Arrays.equals(var5, flag[var3])) {
            var2 = true;
            break;
         }
      }

      if (var2) {
         System.out.println("Flag incorrecta");
      } else {
         System.out.println("Buen trabajo. Has encontrado la flag");
      }

   }
}