1047A_Little C Loves 3 I(构造)

A. Little C Loves 3 I
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Little C loves number «3» very much. He loves all things about it.

Now he has a positive integer nn. He wants to split nn into 33 positive integers a,b,ca,b,c, such that a+b+c=na+b+c=n and none of the 33 integers is a multiple of 33. Help him to find a solution.

Input

A single line containing one integer nn (3n1093≤n≤109) — the integer Little C has.

Output

Print 33 positive integers a,b,ca,b,c in a single line, such that a+b+c=na+b+c=n and none of them is a multiple of 33.

It can be proved that there is at least one solution. If there are multiple solutions, print any of them.

Examples
input
Copy
3
output
Copy
1 1 1
input
Copy
233
output
Copy
77 77 79
被样例困惑了很久,看了题解啧啧,其实这题就是构造
大致题意:给你一个数n,找到三个数a,b,c,使得a+b+c=n,并且a,b,c都不能是3的倍数
分析:当n%3=0时,n-2一定不是3的倍数,可以构造为a=1,b=1,c=n-2;当n%3!=0时,n-3一定不是3的倍数,那么可以构造为,a=1,b=2,c=n-3.注意这个构造是任意的,只要满足条件即可
 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 int main()
 6 {
 7     int n;
 8     while(~scanf("%d",&n))
 9     {
10         if(n%3==0)
11             printf("1 1 %d\n",n-2);
12         else
13             printf("1 2 %d\n",n-3);
14     }
15     return 0;
16 }

 



posted on 2018-10-02 09:16  一只小毛球  阅读(157)  评论(0编辑  收藏  举报

导航