A. Little C Loves 3 I

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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

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

Input

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

Output

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

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

Examples

inputCopy

3

outputCopy

1 1 1

inputCopy

233

outputCopy

77 77 79

签到题,读遍题,就能过!

#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a;
a=n/3;
if(a%3==0){ if(n%3==0) cout<<a-2<<' '<<a+1<<' '<<a+1;
else if(n%3==1) cout<<a-1<<' '<<a+1<<' '<<a+1;
else cout<<a-1<<' '<<a+1<<' '<<a+2;}
if(a%3==1){
if(n%3==0) cout<<a<<' '<<a<<' '<<a;
if(n%3==1) cout<<a<<' '<<a<<' '<<a+1;
if(n%3==2) cout<<a+1<<' '<<a+1<<' '<<a; }
if(a%3==2)
{
if(n%3==0) cout<<a<<' '<<a<<' '<<a;
if(n%3==1) cout<<a-1<<' '<<a+2<<' '<<a;
if(n%3==2) cout<<a<<' '<<a<<' '<<a+2;
}
return 0;
}

CodeForces - 1047A的更多相关文章

  1. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  2. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  3. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  4. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  5. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  6. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  7. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  8. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

  9. CodeForces - 148D Bag of mice

    http://codeforces.com/problemset/problem/148/D 题目大意: 原来袋子里有w只白鼠和b只黑鼠 龙和王妃轮流从袋子里抓老鼠.谁先抓到白色老鼠谁就赢. 王妃每次 ...

随机推荐

  1. 计算机网络协议,UDP数据报的分析

    一.UDP数据报的特点 1.基本特性 UDP是在IP数据报的基础上增加了复用和分用以及差错检测的功能 UDP的主要特点如下: UDP是无连接的:即发送数据之前不需要建立连接 UDP使用尽最大努力交付, ...

  2. python的int float if...else

    # 字符串 string  单引号 ‘ ’  双引号 “  ”-包含的 app = 'dongt woory' 外面单引号里面可以双引号,外面双引号,里面也可以单引号 app ='你是真的“好看”吗' ...

  3. 利用xposed hook Auto.js程序、解密其js脚本

    一.原理 原理很简单就是hook auto.js的com.stardust.autojs.script.StringScriptSource类,当然前题你要逆向的auto.js程序dex没有加固,当然 ...

  4. CentOS安装C函数库的man帮助

    安装linux可能没有安装C的man帮助, 像我安装时选择的是最小化安装就没有, 网上的大多是ubunu的安装方式,或者是C++的man帮助, 都不适合,那么CentOS安装C man手册的方法就是: ...

  5. openwrite使用说明

    访问官网https://openwrite.cn/注册登录 访问https://openwrite.cn/plugin-chrome/ 下载插件和安装插件"OpenWrite助手1.1.4& ...

  6. 如何将一个div水平垂直居中?6种方法做推荐

    方案一: div绝对定位水平垂直居中[margin:auto实现绝对定位元素的居中], 兼容性:,IE7及之前版本不支持 div{ width: 200px; height: 200px; backg ...

  7. Threejs【坐标转换】如何让annotation跟随物体一起旋转

    现在根据鼠标点击的屏幕位置能够得到屏幕的坐标event.clientX和event.clientY,然后我的annotation就初始化在这个屏幕坐标的位置,那么如何绑定annotation和三维物体 ...

  8. linux下的信号量PV操作进阶之路

    一.同步和互斥机制 信号量 互斥锁 同步:指多个任务按照约定的先后次序相互配合来完成一件事情. 比如读线程等待写线程写完之后再去读. 二.信号量-P/V操作 P(s)含义: if(信号量>0) ...

  9. Docker-Bridge Network 03 自定义网络

    本节介绍自定义bridge network的自定义网络. 1.前言2.创建自定义网络2.1 创建网络2.2 指定网段创建网络3.创建容器3.1 指定网络创建容器3.2 指定IP创建容器4.通信4.1 ...

  10. N - Remove Adjacent CodeForces - 1321C

    题目大意:删除字符,当一个字符左边或者右边存在一个比它小“1”的字符那么就可以将这个字符删除,问最多能删除多少个字符 思路,:刚开始想的是,对于单调连续的字符,可以直接删除,比如,单点增的字符只保留前 ...