Ուղարկել | Բոլոր լուծումները | Լավագույն լուծումները | Վերադառնալ ցուցակին |
ACM_0186 - AZTEC PYRAMID |
Aztec emperor Cuitl´ahuac is going to build a pyramid in his honor. This pyramid should be taller than previous ones.
The Aztec pyramid is build out of stone blocks. Each block is 1×1×1-hunab cube. Cuitl´ahuac places first block on the ground during the foundation ceremony. Each of the following blocks must share a face with at least one of the previous blocks.
The block is stable if it stands on the ground, or it stands on another block, that has a block or the ground next to each face. To stand the test of time the pyramid must be stable i.e. each block of it must be stable.
Cuitl´ahuac asks you to determine the height of the tallest stable pyramid that can be built out of available blocks.
Input
The only line of the input file contains a single integer numbern— the number of available blocks, including the first one (1 ≤n≤109 ).
Output
Output the height of the tallest stable pyramid that may be built out ofnblocks. The height must be output in hunabs.
Examples
№ |
stdin |
stdout |
1 |
6 |
2 |
2 |
5 |
1 |
3 |
20 |
3 |
Ավելացրեց. | Հրանտ Հովհաննիսյան |
Ամսաթիվ. | 2014-04-09 |
Ժամանակի սահմանափակումը. | 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 |
Աղբյուրը. | Northern QF 2012.A |