import java.util.*; import java.util.zip.*; import java.util.List; import java.util.regex.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import javax.swing.table.*; import java.io.*; import java.net.*; import java.lang.reflect.*; import java.lang.ref.*; import java.lang.management.*; import java.security.*; import java.security.spec.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.imageio.*; import java.math.*; // by https://www.youtube.com/user/degreespwnu // Solution for: https://www.youtube.com/watch?v=EIWbhB4uLVY (Scam School) class main { public static void main(final String[] args) throws Exception { for(int a=1;a<10;a++){ for(int p=1;p<10;p++){ if(!(p==a)){ for(int e=1;e<10;e++){ if(!(e==p || e==a)){ for(int n=0;n<10;n++){ if(!(n==e || n==p || n==a)){ for(int y=0;y<10;y++){ if(!(y==n || y==e || y==p || y==a)){ for(int s=1;s<10;s++){ if(!(s==y || s==n || s==e || s==p || s==a)){ for(int v=0;v<10;v++){ if(!(v==s || v==y || v==n || v==e || v==p || v==a)){ for(int d=0;d<10;d++){ if(!(d==v || d==s || d==y || d==n || d==e || d==p || d==a)){ for(int i=1;i<10;i++){ if(!(i==d || i==v || i==s || i==y || i==n || i==e || i==p || i==a)){ for(int r=0;r<10;r++){ if(!(r==d || r==v || r==s || r==y || r==n || r==e || r==p || r==a)){ int aCalc = a; String pennyString = String.valueOf(p) + String.valueOf(e) + String.valueOf(n) + String.valueOf(n) + String.valueOf(y); int pennyCalc = Integer.parseInt(pennyString); String savedString = String.valueOf(s) + String.valueOf(a) + String.valueOf(v) + String.valueOf(e) + String.valueOf(d); int savedCalc = Integer.parseInt(savedString); String isString = String.valueOf(i) + String.valueOf(s); int isCalc = Integer.parseInt(isString); String earnedString = String.valueOf(e) + String.valueOf(a) + String.valueOf(r) + String.valueOf(n) + String.valueOf(e) + String.valueOf(d); int earnedCalc = Integer.parseInt(earnedString); int earnedGuess = aCalc + pennyCalc + savedCalc + isCalc + aCalc + pennyCalc; if(earnedCalc == earnedGuess){ System.out.println("A solution was found:"); System.out.println(aCalc); System.out.println(pennyCalc); System.out.println(savedCalc); System.out.println(isCalc); System.out.println(aCalc); System.out.println(pennyCalc); System.out.println("_________________"); System.out.println(earnedCalc); } } } } } } } } } } } } } } } } } } } } } static RuntimeException asRuntimeException(Throwable t) { return t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t); } static Map _registerThread_threads = Collections.synchronizedMap(new WeakHashMap()); static Thread _registerThread(Thread t) { _registerThread_threads.put(t, true); return t; } static void _registerThread() { _registerThread(Thread.currentThread()); } }