codeforces-scrape

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

1326A.md (1687B)


      1 Source: https://codeforces.com/problemset/problem/1326/A
      2 
      3 A. Bad Ugly Numbers
      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 a integer $n$ ($n \gt 0$). Find any integer $s$ which satisfies these conditions, or report that there are no such numbers:
     22 
     23 In the decimal representation of $s$:
     24 
     25 * $s \gt 0$,
     26 * $s$ consists of $n$ digits,
     27 * no digit in $s$ equals $0$,
     28 * $s$ is not divisible by any of it's digits.
     29 
     30 Input
     31 
     32 The input consists of multiple test cases. The first line of the input contains a single integer $t$ ($1 \leq t \leq 400$), the number of test cases. The next $t$ lines each describe a test case.
     33 
     34 Each test case contains one positive integer $n$ ($1 \leq n \leq 10^5$).
     35 
     36 It is guaranteed that the sum of $n$ for all test cases does not exceed $10^5$.
     37 
     38 Output
     39 
     40 For each test case, print an integer $s$ which satisfies the conditions described above, or "-1" (without quotes), if no such number exists. If there are multiple possible solutions for $s$, print any solution.
     41 
     42 Example
     43 
     44 Input
     45 
     46 ```
     47 4
     48 1
     49 2
     50 3
     51 4
     52 ```
     53 
     54 Output
     55 
     56 ```
     57 -1
     58 57
     59 239
     60 6789
     61 ```
     62 
     63 Note
     64 
     65 In the first test case, there are no possible solutions for $s$ consisting of one digit, because any such solution is divisible by itself.
     66 
     67 For the second test case, the possible solutions are: $23$, $27$, $29$, $34$, $37$, $38$, $43$, $46$, $47$, $49$, $53$, $54$, $56$, $57$, $58$, $59$, $67$, $68$, $69$, $73$, $74$, $76$, $78$, $79$, $83$, $86$, $87$, $89$, $94$, $97$, and $98$.
     68 
     69 For the third test case, one possible solution is $239$ because $239$ is not divisible by $2$, $3$ or $9$ and has three digits (none of which equals zero).