#CCBCHBA0000025. Hai biến điều khiển trong for (Two Control Variables in a For Loop)
Hai biến điều khiển trong for (Two Control Variables in a For Loop)
Two Control Variables in a For Loop
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Initialize i=0 and j=n. While i<j, increment i and decrement j once per iteration; output the final i and j.
Input
One integer n in [0,100].
Output
Print i and j after the loop.
Subtasks
- Subtask 1 (20%): .
- Subtask 2 (30%): .
- Subtask 3 (50%): .
Examples
Example 1
Input
5
Output
3 2
Explanation
(0,5)->(1,4)->(2,3)->(3,2), then stop.
Example 2
Input
4
Output
2 2
Explanation
Stop at (2,2) when both values meet.