codeforces-scrape

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

216A.md (1261B)


      1 Source: https://codeforces.com/problemset/problem/216/A
      2 
      3 A. Tiling with Hexagons
      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 Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with hexagonal tiles.
     22 
     23 The hall also turned out hexagonal in its shape. The King walked along the perimeter of the hall and concluded that each of the six sides has *a*, *b*, *c*, *a*, *b* and *c* adjacent tiles, correspondingly.
     24 
     25 To better visualize the situation, look at the picture showing a similar hexagon for *a* = 2, *b* = 3 and *c* = 4.
     26 
     27  ![](https://espresso.codeforces.com/ef313c846e1ffa799bd7c7645372f0ee0e56a554.png) 
     28 
     29 According to the legend, as the King of Berland obtained the values *a*, *b* and *c*, he almost immediately calculated the total number of tiles on the hall floor. Can you do the same?
     30 
     31 Input
     32 
     33 The first line contains three integers: *a*, *b* and *c* (2 ≤ *a*, *b*, *c* ≤ 1000).
     34 
     35 Output
     36 
     37 Print a single number — the total number of tiles on the hall floor.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 2 3 4
     45 ```
     46 
     47 Output
     48 
     49 ```
     50 18
     51 ```