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. python 函数--递归函数

    一.递归函数的定义:在一个函数里面调用函数本身 python限制最大层数:998层 def foo(n): print(n) n+=1 foo(n) foo(1)

  2. 数据结构-Python 列表(List)

    列表是最常用的Python数据类型,它可以作为一个方括号内的逗号分隔值出现 一.列表常用方法 1.创建一个列表,只要把逗号分隔的不同的数据项使用方括号括起来即可. eg:list1 = ['1', ' ...

  3. tf.nn.depthwise_conv2d 卷积

    tf.nn.depthwise_conv2d( input, filter, strides, padding, rate=None, name=None, data_format=None ) 参数 ...

  4. BAT脚本编写要点_特殊字符

    BAT脚本编写要点(1)_特殊字符 分类: 其他 2011-03-20 00:58 5621人阅读 评论(0) 收藏 举报 脚本cdatecmdtreesystem 1. 点 与echo连用,作用是换 ...

  5. AJ学IOS 之CoreLocation地理编码小Demo输入城市得到经纬度

    AJ分享,必须精品 一:效果 输入地名,可以得到相应的经纬度,知识为了学习写的小Demo 二:实现步骤 一 :首先获取用户输入的位置. 二 :创建地理编码对象. 三 :利用地理编码对象编码,根据传入的 ...

  6. AJ学IOS(23)UI之控制器管理

    AJ分享,必须精品 控制器以及view的多种创建方式 控制器view的加载 通过storyboard创建 1:先加载storyboard⽂件(Test是storyboard的⽂文件名) UIStory ...

  7. Mac 窗口管理软件 Spectacle

    我个人使用的窗口管理软件是 Magnet(本人在 Mac 下付费的首款软件,记得是 6 元~),今天为大家介绍一款类似的开源软件. 简介 Spectacle 是一款可以快速调整窗口大小与位置的开源软件 ...

  8. php开发中如何判断 是否微信访问

    在开发中遇到了这样一个需求,仅允许在微信中访问,所以就要对微信浏览器访问进行判断,本篇博文讲述如何判断是否是微信访问. /** * 判断是否微信访问 * @return bool */ functio ...

  9. ADT_Bundle搭建

    1.打开SDK Manager.exe,打开的速度有点慢.点击右下角的[install n packages...],选择[accept ...],点击[install],然后等待安装.过程有点漫长, ...

  10. ASE project demo:pdf

    欢迎使用 pdf ~ 主页面如下,整个app风格一致,保持简约舒适的视觉体验~ 侧边栏打开,可选择打开新的pdf文件,返回主页面,打开本地生词本,登录等操作~ 可以点击侧边栏OpenFile打开新的p ...