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. flask 入门 之 Python Shell (一)

    1.安装插件: pip install flask_script 2.代码: #encoding:utf-8 from flask_sqlalchemy import SQLAlchemy from ...

  2. Python爬虫系列(六):搜索文档树

    今天早上,写的东西掉了.这个烂知乎,有bug,说了自动保存草稿,其实并没有保存.无语 今晚,我们将继续讨论如何分析html文档. 1.字符串 #直接找元素soup.find_all('b') 2.正则 ...

  3. Java课程设计之——爬虫篇

    主要使用的技术 Httplcient Jsoup 多线程 dao模式 网络爬虫简介 网络爬虫(又称为网页蜘蛛,网络机器人,在FOAF社区中间,更经常的称为网页追逐者),是一种按照一定的规则,自动地抓取 ...

  4. Linux下搭建接口自动化测试平台

    前言 我们今天来学习一下在Linux下如何搭建基于HttpRunner开发的接口自动化测试平台吧! 需要在Linux上提前准备的环境(下面是本人搭建时的环境): 1,Python 3.6.8 (可参考 ...

  5. Volatile不保证原子性(二)

    Volatile不保证原子性 前言 通过前面对JMM的介绍,我们知道,各个线程对主内存中共享变量的操作都是各个线程各自拷贝到自己的工作内存进行操作后在写回到主内存中的. 这就可能存在一个线程AAA修改 ...

  6. 【Java】Junit单元测试

    什么是单元测试? 单元测试(unit testing),是指对软件中的最小可测试单元进行检查和验证. 对于单元测试中单元的含义,一般来说,要根据实际情况去判定其具体含义,如C语言中单元指一个函数,Ja ...

  7. G - Number Transformation BFS

    In this problem, you are given an integer number s. You can transform any integer number A to anothe ...

  8. Project configuration is not up-to-date with pom.xml.错误

    完整错误信息:Description Resource Path Location TypeProject configuration is not up-to-date with pom.xml. ...

  9. Jar包一键重启的Shell脚本及新服务器部署的一些经验

    原文首发于博客园,作者:后青春期的Keats:地址:https://www.cnblogs.com/keatsCoder/ 转载请注明,谢谢! 前言 最近公司为客户重新部署了一套新环境,由我来完成了基 ...

  10. Python - 和我聊Python节目最新一期介绍 - 257期:使用超级电脑,Python,射电天文学知识来探索银河系

    今天,给大家简单介绍和我聊Python的最新一期节目,第257期:使用超级电脑,Python,射电天文学知识来探索银河系. 听着标题就觉得高大上,是的,我也是这么认为的.这次请的嘉宾来头很大,来自国际 ...