试编写一个程序,求出以下加密题目的解:
TOO+TOO+TOO+TOO=GOOD
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Test;
/**
*
* @author Jasper
*/
public class puzzleMath {
public static void main(String[] args) {
System.out.println("TOO+TOO+TOO+TOO=GOOD result:");
int T,O,G,D,count=0;
for(T=0;T<=9;T++)
for(O=0;O<=9;O++)
for(G=0;G<=9;G++)
for(D=0;D<=9;D++)
{
if((3*(T*100+O*10+O))==(G*1000+O*100+O*10+D))
{
System.out.println((T*100+O*10+O)+"+"+(T*100+O*10+O)+"+"+(T*100+O*10+O)+"="+(G*1000+O*100+O*10+D));
}
count++;
}
System.out.println(count+" times loop");
}
}