codeforces-scrape

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

53C.md (1286B)


      1 Source: https://codeforces.com/problemset/problem/53/C
      2 
      3 C. Little Frog
      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 Once upon a time a little frog whose name was Vasya decided to travel around his home swamp. Overall there are *n* mounds on the swamp, located on one line. The distance between the neighboring mounds is one meter. Vasya wants to visit all the mounds in one day; besides, he wants to visit each one exactly once. For that he makes a route plan, to decide the order in which to jump on the mounds. Vasya can pick any mound as the first one. He thinks it boring to jump two times at the same distance. That's why he wants any two jumps on his route to have different lengths. Help Vasya the Frog and make the plan for him.
     22 
     23 Input
     24 
     25 The single line contains a number *n* (1 ≤ *n* ≤ 104) which is the number of mounds.
     26 
     27 Output
     28 
     29 Print *n* integers *p**i* (1 ≤ *p**i* ≤ *n*) which are the frog's route plan.
     30 
     31 * All the *p**i*'s should be mutually different.
     32 * All the |*p**i*–*p**i* + 1|'s should be mutually different (1 ≤ *i* ≤ *n* - 1).
     33 
     34 If there are several solutions, output any.
     35 
     36 Examples
     37 
     38 Input
     39 
     40 ```
     41 2
     42 ```
     43 
     44 Output
     45 
     46 ```
     47 1 2
     48 ```
     49 
     50 Input
     51 
     52 ```
     53 3
     54 ```
     55 
     56 Output
     57 
     58 ```
     59 1 3 2
     60 ```