V_AYP2_D - Military

no tags 

Español

A military column of N soldiers, is training and marching, numbered as follows, when six soldiers:

6

5

4

3

2

1

When an officer calls formation, they must act quickly to complete formation in K columns indicated to them, for example if the officer indicates do training in 2 columns, would be as follows:

3 6

2 5

1 4

In the example above, soldier 5 when called to formation, would be in row 2 and column 2. Obviously the military must be very disciplined and always form in an orderly fashion, the first soldiers will always be in the first column, then next in the second column and so on until column K is completed as ordered by the commanding official.

 

Input details:

The first line will contain 2 integers, N,K, Followed by a X number of soldier. N will

always be exactly divisible by K.

 

Output details:

The row and column in which the soldier who was called to formation is in.

 

INPUT

OUTPUT

15 3

8

3 2

 

Constraints:

0<N<=1000000

0<K<=N

0<X<=N 



Added by:Venezuelan Programming League
Date:2013-02-02
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64