Three Consecutive Numbers
Author: QuwsarOhi
Problem Setter: Elias Hassan NaimIntake 32, Department of CSE
Given a number N. You have to find out three integers X, Y,
and Z where,
1.
X
= Y – 1,
2.
Z
= Y + 1, and
3.
X
+ Y + Z = N.
Output Format
If no valid
solution exists, print -1. Otherwise,
print X, Y, and Z in a line
and print a space between every two consecutive integers. Check sample
input/output for clarity.
Samples
Input
6
Output
1 2 3
Input
8
Output
-1
Limits
Language | Time | Memory |
GNU C 11 | 1s | 512MB |
GNU C++ 14 | 1s | 512MB |
GNU C++ 11 | 1s | 512MB |
Statistics