codeforces 669A A. Little Artem and Presents(水题)
题目链接:
2 seconds
256 megabytes
standard input
standard output
Little Artem got n stones on his birthday and now wants to give some of them to Masha. He knows that Masha cares more about the fact of receiving the present, rather than the value of that present, so he wants to give her stones as many times as possible. However, Masha remembers the last present she received, so Artem can't give her the same number of stones twice in a row. For example, he can give her 3 stones, then 1 stone, then again 3 stones, but he can't give her 3 stones and then again 3 stones right after that.
How many times can Artem give presents to Masha?
The only line of the input contains a single integer n (1 ≤ n ≤ 109) — number of stones Artem received on his birthday.
Print the maximum possible number of times Artem can give presents to Masha.
1
1
2
1
3
2
4
3
In the first sample, Artem can only give 1 stone to Masha.
In the second sample, Atrem can give Masha 1 or 2 stones, though he can't give her 1 stone two times.
In the third sample, Atrem can first give Masha 2 stones, a then 1 more stone.
In the fourth sample, Atrem can first give Masha 1 stone, then 2 stones, and finally 1 stone again.
题意:
问每次给个数,相邻的数不能一样,和为n,怎么才能使次数最多,最多为多少次;
思路:
次数最多,那么就尽量为1和2了;
AC代码:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+;
const ll inf=1e15;
const int N=1e5+; int main()
{ int n;
scanf("%d",&n);
if(n%==)printf("%d\n",n/*);
else if(n%==)printf("%d\n",n/*+);
else
{
printf("%d\n",n/*+);
}
return ;
}
codeforces 669A A. Little Artem and Presents(水题)的更多相关文章
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- codeforces 669B B. Little Artem and Grasshopper(水题)
题目链接: B. Little Artem and Grasshopper time limit per test 2 seconds memory limit per test 256 megaby ...
- codeforces 669C C. Little Artem and Matrix(水题)
题目链接: C. Little Artem and Matrix time limit per test 2 seconds memory limit per test 256 megabytes i ...
- codeforces Gym 100187L L. Ministry of Truth 水题
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...
- Codeforces Round #185 (Div. 2) B. Archer 水题
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...
- Educational Codeforces Round 14 A. Fashion in Berland 水题
A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...
- Codeforces Round #360 (Div. 2) A. Opponents 水题
A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...
- Codeforces Round #190 (Div. 2) 水果俩水题
后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...
- Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告
对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...
随机推荐
- awk如何区分shell脚本传进来的参数和自身的参数?awk如何获取shell脚本传进来的参数;awk中如何执行shell命令
问题:对于shell脚本,$0表示脚本本身,$1表示脚本的第一个参数,$2……依次类推:对于awk,$1表示分割后的第一个字段,$2……依次类推.那么对于shell脚本中的awk如何区分两者呢? 答案 ...
- 6.【nuxt起步】-完成一个静态的页面
1.接下来新建/component/maincontent.vue 把这些html代码copy到maincontent.vue 发现格式比较难看,就格式化一下 2.插件安装 beautify,安装后重 ...
- 漫谈深度学习时代点击率预估技术进展 &&深度学习在推荐系统上的发展
转载:https://www.infoq.cn/article/XA055tpFrprUy*0UBdCb https://www.zhihu.com/question/20830906/answer/ ...
- java线程中Exchanger使用
有时我们须要对元素进行配对和交换线程的同步点,使用exchange方法 返回其伙伴的对象,这时我们就须要使用线程类中的Exchanger类了, 我通过一个实例 来简单说明一下他的用法及其作用: imp ...
- json解析神器 jsonpath的使用
转载:http://blog.csdn.net/qq_20641565/article/details/77162868 如果项目需求是从某些复杂的json里面取值进行计算,用jsonpath+IK( ...
- Solidworks提示字体Arial Unicode MS安装不正确,PDF文件中一个或多个文本字串可能遗失怎么办
从以下网站下载Arial Unicode MS字体,WIN7的直接安装即可,XP的放到windows\fonts文件夹内.重启Solidworks即可 http://font.chinaz.com/1 ...
- python(36)- 测试题
1.8<<2等于? 32 “<<”位运算 264 132 64 32 16 8 4 2 1 原始位置 0 0 0 0 0 1 0 0 0 想左位移2位 0 0 0 1 0 0 ...
- [C#]使用 C# 代码实现拓扑排序 dotNet Core WEB程序使用 Nginx反向代理 C#里面获得应用程序的当前路径 关于Nginx设置端口号,在Asp.net 获取不到的,解决办法 .Net程序员 初学Ubuntu ,配置Nignix 夜深了,写了个JQuery的省市区三级级联效果
[C#]使用 C# 代码实现拓扑排序 目录 0.参考资料 1.介绍 2.原理 3.实现 4.深度优先搜索实现 回到顶部 0.参考资料 尊重他人的劳动成果,贴上参考的资料地址,本文仅作学习记录之用. ...
- Oracle oledb 打包并集成到程序安装包(VC ADO訪问Oracle)
近期有一个项目和oracle交互,我用的是ADO的方式进行试问操作. 首先把数据库连接的东东记录一下,老了记性不好啊! 操作例如以下: //连接串这么写的话就能够不用配置 tnsnames.ora配置 ...
- shiro框架的使用
1.配置二级缓存 <ehcache updateCheck="false" name="shiroCache"> <defaultCache ...