链接:

https://codeforces.com/contest/1221/problem/A

题意:

You are playing a variation of game 2048. Initially you have a multiset s of n integers. Every integer in this multiset is a power of two.

You may perform any number (possibly, zero) operations with this multiset.

During each operation you choose two equal integers from s, remove them from s and insert the number equal to their sum into s.

For example, if s={1,2,1,1,4,2,2} and you choose integers 2 and 2, then the multiset becomes {1,1,1,4,4,2}.

You win if the number 2048 belongs to your multiset. For example, if s={1024,512,512,4} you can win as follows: choose 512 and 512, your multiset turns into {1024,1024,4}. Then choose 1024 and 1024, your multiset turns into {2048,4} and you win.

You have to determine if you can win this game.

You have to answer q independent queries.

思路:

将不大于2048的加起来判断

代码:

#include <bits/stdc++.h>
using namespace std; int main()
{
int t, a, b, c;
cin >> t;
while (t--)
{
cin >> a >> b >> c;
if (a < b)
swap(a, b);
c += (a-b);
a = b;
int sum = min(a, c);
a -= sum, b -= sum, c -= sum;
cout << sum+(a+b)/3 << endl;
} return 0;
}

Educational Codeforces Round 73 (Rated for Div. 2) A. 2048 Game的更多相关文章

  1. Educational Codeforces Round 73 (Rated for Div. 2)

    传送门 A. 2048 Game 乱搞即可. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #de ...

  2. Educational Codeforces Round 73 (Rated for Div. 2) D. Make The Fence Great Again(DP)

    链接: https://codeforces.com/contest/1221/problem/D 题意: You have a fence consisting of n vertical boar ...

  3. Educational Codeforces Round 73 (Rated for Div. 2) B. Knights(构造)

    链接: https://codeforces.com/contest/1221/problem/B 题意: You are given a chess board with n rows and n ...

  4. Educational Codeforces Round 73 (Rated for Div. 2) C. Perfect Team

    链接: https://codeforces.com/contest/1221/problem/C 题意: You may have already known that a standard ICP ...

  5. Educational Codeforces Round 73 (Rated for Div. 2)F(线段树,扫描线)

    这道题里线段树用来区间更新(每次给更大的区间加上当前区间的权重),用log的复杂度加快了更新速度,也用了区间查询(查询当前区间向右直至最右中以当前区间端点向右一段区间的和中最大的那一段的和),也用lo ...

  6. Educational Codeforces Round 73 (Rated for Div. 2)E(思维,博弈)

    //这道题博弈的核心就是不能让后手有一段只能放b而长度不够放a的段,并且先手要放最后一次#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h> ...

  7. Educational Codeforces Round 73 (Rated for Div. 2)D(DP,思维)

    #define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;long long a[300007],b[3 ...

  8. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  9. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

随机推荐

  1. [LuoguP2159][SHOI2009]舞会_动态规划_高精度_排列组合

    舞会 题目链接:https://www.luogu.org/problem/P2159 数据范围:略. 题解: 不会.... 看了题解觉得自己好傻逼啊

  2. No package 'eventlog' found

    syslog-ng のインスト�ル手� ●ダウンロ�ドサイト http://www.balabit.com/downloads/files/syslog-ng/sources/stable/src/ ...

  3. Nginx04---实现直播

    比如树莓派开启一个直播服务如何开启: 百度搜索:搭建自己的直播服务器(nginx + RTMP)

  4. ThreadLocal父子线程之间的数据传递问题

    一.问题的提出 在系统开发过程中常使用ThreadLocal进行传递日志的RequestId,由此来获取整条请求链路.然而当线程中开启了其他的线程,此时ThreadLocal里面的数据将会出现无法获取 ...

  5. 【AtCoder】Mujin Programming Challenge 2017

    Mujin Programming Challenge 2017 A - Robot Racing 如果每个数都是一个一个间隔开的,那么答案是\(n!\) 考虑把一个数挪到1,第二个数挪到3,以此类推 ...

  6. 剑指offer1: 组类型——二维数组中的查找(给定一个数字,查找是否在该数组中)

    1. 思路: 缩小范围 2. 方法: (1)要查找的数字等于数组中的数字,结束查找过程: (2)要查找的数字小于数组中的数字,去除该数字右边的数字,在剩下的数字里查找: (3)要查找的数字大于数组中的 ...

  7. 机器猫css

    <html> <head>  <title>机器猫</title>  <style>   div{    width: 30px;    h ...

  8. Pycharm 配置houdini

    一.houdini开发环境配置 1.添加Python可执行文件 2.设置代码自动补全 刚刚添加的Python.exe,右侧点击加号,依次添加以上长方形中的文件,路径会根据个人安装路径有所变化,后面的目 ...

  9. gulp做简单的js压缩

    安装工具 全局安装npm install --global gulp 项目的依赖安装npm install --save-dev gulp npm install --save-dev gulp-re ...

  10. vue统一注册组件

    文件夹下面组件数量较多,如果每一个组件先import然后在 components,虽然灭有问题,但是会导致代码量大,而且不直观 解决办法: 将图元组件进行统一注册 新建一个pixels文件,文件里面的 ...