codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1526B.md (1053B)


      1 Source: https://codeforces.com/problemset/problem/1526/B
      2 
      3 B. I Hate 1111
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 You are given an integer $x$. Can you make $x$ by summing up some number of $11, 111, 1111, 11111, \ldots$? (You can use any number among them any number of times).
     22 
     23 For instance,
     24 
     25 * $33=11+11+11$
     26 * $144=111+11+11+11$
     27 
     28 Input
     29 
     30 The first line of input contains a single integer $t$ $(1 \leq t \leq 10000)$ — the number of testcases.
     31 
     32 The first and only line of each testcase contains a single integer $x$ $(1 \leq x \leq 10^9)$ — the number you have to make.
     33 
     34 Output
     35 
     36 For each testcase, you should output a single string. If you can make $x$, output "YES" (without quotes). Otherwise, output "NO".
     37 
     38 You can print each letter of "YES" and "NO" in any case (upper or lower).
     39 
     40 Example
     41 
     42 Input
     43 
     44 ```
     45 3
     46 33
     47 144
     48 69
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 YES
     55 YES
     56 NO
     57 ```
     58 
     59 Note
     60 
     61 Ways to make $33$ and $144$ were presented in the statement. It can be proved that we can't present $69$ this way.