All Tracks Basic Programming Recursion Recursion and Backtracking Problem

Hack the money
Tag(s):
No tags
Problem
Editorial
Analytics

You are a bank account hacker.Initially you have 1 rupee in your account, and you want exactly N rupees in your account.You wrote two hacks, First hack can multiply the amount of money you own by 10, while the second can multiply it by 20. These hacks can be used any number of time . Can you achieve the desired amount N using these hacks.
Constraints:

1<=T<=100

1<=N<=10^12

Input ->

  • The first line of the input contains a single integer T denoting the number of test cases.
  • The description of T test cases follows.The first and only line of each test case contains a single integer N.  

 Output ->For each test case, print a single line containing the string "Yes" if you can make exactly N rupees or "No" otherwise.

SAMPLE INPUT
5
1
2
10
25
200
SAMPLE OUTPUT
Yes
No
Yes
No
Yes
Explanation

In the last case hacker can get Rs. 200 by first using 10x hack and then using 20x hack once.

1 -> 10 -> 200

 

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications

?