1047a_little C Loves 3 I (construction)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.