A. Little Artem and Presents

题目连接:

http://www.codeforces.com/contest/669/problem/A

Description

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?

Input

The only line of the input contains a single integer n (1 ≤ n ≤ 109) — number of stones Artem received on his birthday.

Output

Print the maximum possible number of times Artem can give presents to Masha.

Sample Input

1

Sample Output

1

Hint

题意

A同学有n个糖果,然后每一次可以给人任意个糖果,但是给出去的糖果数量得保证和上一次的数量不一样。

问你最多能给多少手

题解:

肯定就这样嘛,1 2 1 2 1 2 1 2,这样贪心一波就好了

代码

#include<bits/stdc++.h>
using namespace std; int main()
{
long long n;cin>>n;
cout<<(n/3)*2+((n%3)?1:0)<<endl;
}

Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题的更多相关文章

  1. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance

    题目链接: http://codeforces.com/contest/669/problem/D 题意: 给你一个初始序列:1,2,3,...,n. 现在有两种操作: 1.循环左移,循环右移. 2. ...

  2. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 1 Edition) C. Little Artem and Random Variable 数学

    C. Little Artem and Random Variable 题目连接: http://www.codeforces.com/contest/668/problem/C Descriptio ...

  3. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) E. Little Artem and Time Machine 树状数组

    E. Little Artem and Time Machine 题目连接: http://www.codeforces.com/contest/669/problem/E Description L ...

  4. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟

    D. Little Artem and Dance 题目连接: http://www.codeforces.com/contest/669/problem/D Description Little A ...

  5. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) C. Little Artem and Matrix 模拟

    C. Little Artem and Matrix 题目连接: http://www.codeforces.com/contest/669/problem/C Description Little ...

  6. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) B. Little Artem and Grasshopper 模拟题

    B. Little Artem and Grasshopper 题目连接: http://www.codeforces.com/contest/669/problem/B Description Li ...

  7. Codeforces Round #348(VK Cup 2016 - Round 2)

    A - Little Artem and Presents (div2) 1 2 1 2这样加就可以了 #include <bits/stdc++.h> typedef long long ...

  8. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D

    D. Little Artem and Dance time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  9. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) C

    C. Little Artem and Matrix time limit per test 2 seconds memory limit per test 256 megabytes input s ...

随机推荐

  1. MongoDB 3.4.2 配置 CentOS 6.5 远程连接

    1.新建用户 db.createUser({user: 'test', pwd: 'myPassword', roles: [{role: 'readWrite', db: 'test_db'}]}) ...

  2. [转载]FFmpeg完美入门[2] - FFmpeg参数说明

     1 通用选项 -L license -h 帮助 -fromats 显示可用的格式,编解码的,协议的. -f fmt 强迫采用格式fmt -i filename 输入文件 -y 覆盖输出文件 -t d ...

  3. count(*)与count(1)、count('xxx')等在使用语法方面的区别

    语法方面: 区别就是:没有区别!!! “*”号是通配符: “*”号是通配符 “*”号是通配符 使用"*"号和使用其他数字和任意非字段字符在使用方面没有任何语法错误; 至于效率方面是 ...

  4. java版云笔记(八)之关联映射

    Mybatis关联映射 通过数据库对象之间的关联关系,反映到到实体对象之间的引用. 加载多个表中的关联数据,封装到我们的实体对象中. 当业务对数据库进行关联查询. 关联 <association ...

  5. FreeMarker使用之比较if

    1. =或者==:判断两个值是否相等. 2. !=:判断两个值是否不等. 3. >或者gt:判断左边值是否大于右边值 4. >=或者gte:判断左边值是否大于等于右边值 5. <或者 ...

  6. Effective STL 阅读笔记: Item 4 ~ 5: Call empty instead of checking size() against zero.

    Table of Contents 1 Item 4: Call empty instead of checking size() against zero 2 Item 5: Prefer rang ...

  7. Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:

    使用自己的jdk

  8. 使用亚马逊云服务器EC2做深度学习(一)申请竞价实例

    这是<使用亚马逊云服务器EC2做深度学习>系列的第一篇文章. (一)申请竞价实例  (二)配置Jupyter Notebook服务器  (三)配置TensorFlow  (四)配置好的系统 ...

  9. day4递归原理及实现

    递归 特定: 递归算法是一种直接或者间接地调用自身算法的过程.在计算机编写程序中,递归算法对解决一大类问题十分有效,它往往是算法的描述简洁而且易于理解. 递归算法解决问题的特点: (1)递归就是在过程 ...

  10. hadoop环境安装及错误总结

    历时N天的hadoop环境,终于配好了 主要参考 Hadoop集群安装配置教程_Hadoop2.6.0_Ubuntu/CentOS 1.开机默认进入字符界面或者是图形界面:http://blog.cs ...