A. Little C Loves 3 itime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Little C loves number«3»very much. He loves all things about it.
Now he has a positive integerNN. He wants to splitNN into33 positive integersA,B,CA,b,c, such thatA+B+C=na+b+c=n and none of the < Span id= "Mathjax-element-6-frame" class= "mjx-chtml mathjax_chtml" data-mathml= " 3 " >33 integers is a multiple of 3 "> 33. Help him to find a solution.
Input
A single line containing one integerNN (3≤n≤93≤n≤109)-the integer Little C has.
Output
Print33 positive integersA,B,CA,b,c in a, such.A+b+ c= na+b+c=n and none of them is a Multiple Of 3 " >3< Span class= "Mjx_assistive_mathml" >3.
It can be proved this there is at least one solution. If There is multiple solutions, print any of them.
Examplesinputcopy
3
Outputcopy
1 1 1
Inputcopy
233
Outputcopy
77 77 79
was puzzled by the sample for a long time, read the problem of Tut, in fact, this is the construction
Approximate test instructions: give you a number n, find three number a,b,c, make a+b+c=n, and a,b,c can not be a multiple of 3
Analysis: When n%3=0, n-2 must not be a multiple of 3, can be constructed as a=1,b=1,c=n-2; when n%3!=0, n-3 must not be a multiple of 3, then can be constructed as, a=1,b=2,c=n-3. Note that this construct is arbitrary, as long as the conditions are met
1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 intMain ()6 {7 intN;8 while(~SCANF ("%d",&N))9 {Ten if(n%3==0) Oneprintf"1 1%d\n", N-2); A Else -printf"1 2%d\n", N-3); - } the return 0; -}
1047a_little C Loves 3 I (construction)