Advertisement
Emiliatan

d299

May 21st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.96 KB | None | 0 0
  1. /* d299            */
  2. /* AC (74ms, 88KB) */
  3. #include <cstdio>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. bool Numberlock[10]{};
  9.  
  10. int main()
  11. {
  12.     for(int F = 0; F < 10; ++F)
  13.     {
  14.         Numberlock[F] = true;
  15.         for(int O = 0; O < 10; ++O)
  16.         {
  17.             if(Numberlock[O]) continue;
  18.             Numberlock[O] = true;
  19.             for(int R = 0; R < 10; ++R)
  20.             {
  21.                 if(Numberlock[R]) continue;
  22.                 Numberlock[R] = true;
  23.                 for(int T = 0; T < 10; ++T)
  24.                 {
  25.                     if(Numberlock[T]) continue;
  26.                     Numberlock[T] = true;
  27.                     for(int Y = 0; Y < 10; ++Y)
  28.                     {
  29.                         if(Numberlock[Y]) continue;
  30.                         Numberlock[Y] = true;
  31.                         for(int E = 0; E < 10; ++E)
  32.                         {
  33.                             if(Numberlock[E]) continue;
  34.                             Numberlock[E] = true;
  35.                             for(int N = 0; N < 10; ++N)
  36.                             {
  37.                                 if(Numberlock[N]) continue;
  38.                                 Numberlock[N] = true;
  39.                                 for(int S = 0; S < 10; ++S)
  40.                                 {
  41.                                     if(Numberlock[S]) continue;
  42.                                     Numberlock[S] = true;
  43.                                     for(int I = 0; I < 10; ++I)
  44.                                     {
  45.                                         if(Numberlock[I]) continue;
  46.                                         Numberlock[I] = true;
  47.                                         for(int X = 0; X < 10; ++X)
  48.                                         {
  49.                                             if(Numberlock[X]) continue;
  50.                                             Numberlock[X] = true;
  51.                                             if((Y + N + N) % 10 == Y)
  52.                                             {
  53.                                                 int offset2 = (Y + N + N) / 10;
  54.                                                 if((offset2 + T + E + E) % 10 == T)
  55.                                                 {
  56.                                                     int offset3 = (offset2 + T + E + E) / 10;
  57.                                                     if((offset3 + R + T + T) % 10 == X)
  58.                                                     {
  59.                                                         int offset4 = (offset3 + R + T + T) / 10;
  60.                                                         if((offset4 + O) % 10 == I)
  61.                                                         {
  62.                                                             int offset5 = (offset4 + O) / 10;
  63.                                                             if(offset5 + F == S)
  64.                                                                 printf("%d%d%d%d%d + %d%d%d + %d%d%d = %d%d%d%d%d", F, O, R, T, Y, T, E, N, T, E, N, S, I, X, T, Y);
  65.                                                         }
  66.                                                     }
  67.                                                 }
  68.                                             }
  69.                                             Numberlock[X] = false;
  70.                                         }
  71.                                         Numberlock[I] = false;
  72.                                     }
  73.                                     Numberlock[S] = false;
  74.                                 }
  75.                                 Numberlock[N] = false;
  76.                             }
  77.                             Numberlock[E] = false;
  78.                         }
  79.                         Numberlock[Y] = false;
  80.                     }
  81.                     Numberlock[T] = false;
  82.                 }
  83.                 Numberlock[R] = false;
  84.             }
  85.             Numberlock[O] = false;
  86.         }
  87.         Numberlock[F] = false;
  88.     }
  89.     return 0;
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement