CodeForces 1047A Little C Loves 3 I (水題)
阿新 • • 發佈:2018-12-11
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
把一個數拆成三個數,並且使每個數都是3的倍數
直接分類討論即可
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> #include<algorithm> #include<iostream> #define ll long long #define ull unsigend long long const int M=1e3+5; const int N=998244353; int n,a,b,c; void solve(int n) { if(n%3==0) { printf("%d %d %d\n",1,1,n-2); } else if(n%3==1) { printf("%d %d %d\n",1,1,n-2); } else if(n%3==2) { printf("%d %d %d\n",1,2,n-3); } } int main() { int n,m; while(~scanf("%d",&n)) { solve(n); } return 0; }