#CCBCHBA0000085. Squared and Cubed (Squared and Cubed)
Squared and Cubed (Squared and Cubed)
Squared and Cubed
Source: beecrowd 1143
Problem Statement
Given an integer n satisfying 1<n<1000, for each i from 1 through n print one line containing i, i squared, and i cubed, separated by single spaces.
Input
One line containing exactly one integer n.
Output
Print exactly the required output described above. Do not print prompts, extra characters, or blank lines. For numerical rows, separate adjacent values with a single space and no trailing space.
Subtasks
- Subtask 1 (20%): 2 <= n <= 5.
- Subtask 2 (30%): 2 <= n <= 30.
- Subtask 3 (50%): 2 <= n <= 999.
Examples
Example 1
Input:
2
Output:
1 1 1
2 4 8
Explanation:
At i=1, both powers equal 1; at i=2, they are 4 and 8.
Example 2
Input:
5
Output:
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
Explanation:
Each row i contains i, ii and ii*i; row 5 is 5 25 125.