codeforces-scrape

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

742A.md (1052B)


      1 Source: https://codeforces.com/problemset/problem/742/A
      2 
      3 A. Arpa’s hard exam and Mehrdad’s naive cheat
      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 There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.
     22 
     23 Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one question, given *n*, print the last digit of 1378*n*.
     24 
     25  ![](https://espresso.codeforces.com/ac805c7c78540a009fed5a8407fb3448d2a085a6.png) 
     26 
     27 Mehrdad has become quite confused and wants you to help him. Please help, although it's a naive cheat.
     28 
     29 Input
     30 
     31 The single line of input contains one integer *n* (0  ≤  *n*  ≤  109).
     32 
     33 Output
     34 
     35 Print single integer — the last digit of 1378*n*.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 1
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 8
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 2
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 4
     61 ```
     62 
     63 Note
     64 
     65 In the first example, last digit of 13781 = 1378 is 8.
     66 
     67 In the second example, last digit of 13782 = 1378·1378 = 1898884 is 4.