codeforces-scrape

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

72H.md (1714B)


      1 Source: https://codeforces.com/problemset/problem/72/H
      2 
      3 H. Reverse It!
      4 
      5 time limit per test
      6 
      7 4 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 The 14th of March was the international day of mathematics, because of number π = 3.1415926...
     22 
     23 In the occasion of this day Goofy Nephews Unity Organization (GNU) wants to publish the fastest program in math at 1:59:26 AM.
     24 
     25 Now the time is 1:11:11 AM and the project team haven't checked their program yet. Because of shortage of time they want to check their program with some queries. So they hired Hormizd (one of the greatest programmers in world) to write a tester for GNU's new program. Because Hormizd has much more important things to do, he wants you to write a small part of tester and it is reversing the numbers. Help him before 1:59:26.
     26 
     27 We can reverse numbers easily. For example by reversing 1234 we get 4321.
     28 
     29 Note, that if the integer is negative then its reverse would be also negative. For example reverse of  - 123 is  - 321.
     30 
     31 Also, you have to delete all the leading zeroes before and after the reverse.
     32 
     33 Given an integer you have to help Hormizd reverse it.
     34 
     35 Input
     36 
     37 The first line contains a single integer *n*. It is less than 101000 by it's absolute value. This integer may have leading zeros. If it had leading zeros you should first omit them and print the reverse of remaining digits. It's guaranteed that input contains less than 10001 characters.
     38 
     39 Output
     40 
     41 Output a single integer, the reverse of the given number. You have to omit leading zeros in the output.
     42 
     43 Examples
     44 
     45 Input
     46 
     47 ```
     48 23
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 32
     55 ```
     56 
     57 Input
     58 
     59 ```
     60 -032
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 -23
     67 ```
     68 
     69 Input
     70 
     71 ```
     72 01234560
     73 ```
     74 
     75 Output
     76 
     77 ```
     78 654321
     79 ```