codeforces-scrape

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

470A.md (701B)


      1 Source: https://codeforces.com/problemset/problem/470/A
      2 
      3 A. Crystal Ball Sequence
      4 
      5 time limit per test
      6 
      7 2 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 Crystal ball sequence on hexagonal lattice is defined as follows: *n*-th element is the number of lattice points inside a hexagon with (*n* + 1) points on each side. The formula is *H**n* = 3·*n*·(*n* + 1) + 1. You are given *n*; calculate *n*-th element of the sequence.
     22 
     23 Input
     24 
     25 The only line of input contains an integer *n* (0 ≤ *n* ≤ 9).
     26 
     27 Output
     28 
     29 Output the *n*-th element of crystal ball sequence.
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 1
     37 ```
     38 
     39 Output
     40 
     41 ```
     42 7
     43 ```
     44 
     45 Input
     46 
     47 ```
     48 3
     49 ```
     50 
     51 Output
     52 
     53 ```
     54 37
     55 ```