public class Fukumen2{
  public static void main(String[] args){
  
       int u, s, a, r, p, e, c;
       int usa, ussr, peace;
       int misu;

       u = s = a = r = p = e = c = 0;
       for (misu=0; misu<1000; misu++) {
       for (u=1;u<10;u++) {
       for (s=0;s<10;s++) {
       for (a=0;a<10;a++) {
       for (r=0;r<10;r++) {
       for (p=1;p<10;p++) {
       for (e=0;e<10;e++) {
       for (c=0;c<10;c++) {
               if (u==s || u==a || u==r || u==p || u==e || u==c) continue;
               if (s==u || s==a || s==r || s==p || s==e || s==c) continue;
               if (a==s || a==u || a==r || a==p || a==e || a==c) continue;
               if (r==s || r==a || r==u || r==p || r==e || r==c) continue;
               if (p==s || p==a || p==r || p==u || p==e || p==c) continue;
               if (e==s || e==a || e==r || e==p || e==u || e==c) continue;
               if (c==s || c==a || c==r || c==p || c==e || c==u) continue;

               usa = 100*u + 10*s + a;
               ussr = 1000*u + 100*s + 10*s + r;
               peace =  10000*p + 1000*e + 100*a + 10*c + e;
/*
               if (usa + ussr == peace) {
                       printf("U=%d S=%d A=%d R=%d P=%d E=%d C=%d\n\n"
                               ,u,s,a,r,p,e,c);
                       printf("   %d%d%d\n",u,s,a);
                       printf("+ %d%d%d%d\n",u,s,s,r);
                       printf("------\n");
                       printf(" %d%d%d%d%d\n",p,e,a,c,e);
               }

/

       }}}}}}}
}
    System.out.println("Hello World!!");
  }
}

タグ:

+ タグ編集
  • タグ:

このサイトはreCAPTCHAによって保護されており、Googleの プライバシーポリシー利用規約 が適用されます。

最終更新:2020年06月13日 17:52