A. Little C Loves 3 I(构造)Codeforces Round #511 (Div. 2)

原题链接: https://codeforces.com/problemset/problem/1047/A

在这里插入图片描述
测试样例

Input
3
Output
1 1 1
Input
233
Output
77 77 79

题意: 给定一个整数 n n n,你需要将这个整数拆成3个不能被3整除的数。

解题思路: 构造类问题,考虑整数 n n n能否被 3 3 3整除来构造。简单的签到题。

AC代码

/*
*邮箱:unique_powerhouse@qq.com
*blog:https://me.csdn.net/hzf0701
*注:文章若有任何问题请私信我或评论区留言,谢谢支持。
*
*/
#include<bits/stdc++.h>//POJ不支持

#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=a;i>=n;i--)

using namespace std;

const int inf=0x3f3f3f3f;//无穷大。
const int maxn=1e5;//限定值。
typedef long long ll;

int n;
int main(){
	while(cin>>n){
		cout<<1<<" ";
		n-=1;
		if((n-1)%3==0){
			cout<<2<<" "<<n-2<<endl;
		}
		else{
			cout<<1<<" "<<n-1<<endl;
		}
	}
	return 0;
}
posted @ 2022-03-26 16:49  unique_pursuit  阅读(27)  评论(0)    收藏  举报