Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0027 - NUMBER TRICK |
Lukas is to hold a presentation on useful mathematical tricks. E.g., to take the square root of a number you just need to remove the first half of the number. To convince his audience he uses the well tested method of proof by example: √25 = 5 and √5776 = 76 so the method obviously works. To multiply a number by X = 2.6 all you have to do is move the first digit to the end of the number, 135×2.6 = 351 and 270270×2.6 = 702702.
Lukas wants to demonstrate that this last method works for any X. To do this he will ask his audience for values of X and then show them example multipli- cations for which the method works. Lukas has noticed that he can not just pick arbitrary numbers for his examples, so now he wants your help. Can you write a program that given X gives a list of integers for which multiplying by X is equivalent to moving the first digit to the end of the number? Lukas does not like very large numbers so do not list any numbers with more than 8 digits.
Input
The input is a single decimal number X (1 ≤ X < 1000) with at most 4 digits after the decimal point.
Output
Output a list of all positive integers less than 108 for which Lukas’ second trick works. Write the numbers in ascending order, one number per line. If the list is empty, output instead “No solution”.
Examples
№ |
stdin |
stdout |
1 |
2.6 |
135 270 135135 270270 |
2 |
3.1416 |
No solution |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2013-12-15 |
Ժամանակի սահմանափակումը. | 1s |
Ծրագրի տեքստի սահմանափակումը. | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Լեզուներ. | Բոլորը բացի ASM32 ASM64 GAWK CLPS CLOJURE D ERL FSHARP FORTRAN GOSU HASK ICON ICK NEM NIM OBJC-CLANG PICO PIKE PYPY PYPY3 PY_NBC RUST SCM guile CHICKEN SED TCL WHITESPACE |
Աղբյուրը. | Nordic (NCPC) 2013.C |