题干:
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 (3≤n≤1093≤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
3
Output
1 1 1
Input
233
Output
77 77 79
解题报告:
还有一个后续题目,是关于曼哈顿距离的,暂时还没学,题解先放着 我是题解
这道题就比较水了啊,属于三元组但是却不需要这么分析,因为n太大了,1e9,所以考虑构造。
其实也比较好构造啊,,比较容易满足题意。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int a,b,c;
cin>>n;
if(n%3==0) {
a=1;b=1;
c=n-a-b;
}
else {
a=1,b=2;
c=n-a-b;
}
printf("%d %d %d\n",a,b,c);
return 0;
}
AC代码: