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 @   unique_pursuit  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示