ACM-ICPC 2019 山东省省赛 M Sekiro
Sekiro: Shadows Die Twice is an action-adventure video game developed by FromSoftware and published by Activision. In the game, the players act as a Sengoku period shinobi known as Wolf as he attempts to take revenge on a samurai clan who attacked him and kidnapped his lord.
As a game directed by Hidetaka Miyazaki, Sekiro (unsurprisingly) features a very harsh death punishment. If the player dies when carrying amount of money, the amount of money will be reduced to , where indicates the smallest integer that .
As a noobie of the game, BaoBao has died times in the game continuously. Given that BaoBao carried amount of money before his first death, and that BaoBao didn’t collect or spend any money during these deaths, what’s the amount of money left after his deaths?
Input
There are multiple test cases. The first line of the input contains an integer (about ), indicating the number of test cases. For each test case:
The first and only line contains two integers and (, ), indicating the initial amount of money BaoBao carries and the number of times BaoBao dies in the game.
Output
For each test case output one line containing one integer, indicating the amount of money left after deaths.
Sample Input
4
10 1
7 1
10 2
7 2
Sample Output
5
4
3
2
Hint
For the third sample test case, when BaoBao dies for the first time, the money he carries will be reduced from 10 to 5; When he dies for the second time, the money he carries will be reduced from 5 to 3.
除了2^31是int最大值,这一点。就是个签到题。大于31直接输出1,恭喜入坑,0的时候是零;
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--){
long long mon,op;
scanf("%lld %lld",&mon,&op);
if(mon==0) cout<<0<<endl;
else if(op>31)cout<<1<<endl;
else
for(int i=0;i<op;i++)
{
if(mon%2==1) mon=mon/2+1;
else mon/=2;
}
cout<<mon<<endl;
}
return 0;
}
ACM-ICPC 2019 山东省省赛 M Sekiro的更多相关文章
- ICPC 2019 徐州网络赛
ICPC 2019 徐州网络赛 比赛时间:2019.9.7 比赛链接:The Preliminary Contest for ICPC Asia Xuzhou 2019 赛后的经验总结 // 比赛完才 ...
- ACM-ICPC 2019 山东省省赛总结
五题手快拿银,不然拿铜,甚至不拿,从结果上来看拿了铜牌对第一年的我们来说算好的,也不算太好. 从拿奖后的第一天,我想写这篇博客,但是我忍了下来,那时候被喜悦冲昏了头脑,当 冷静下来,我开始打算写这篇博 ...
- 2014 ACM/ICPC 鞍山赛区现场赛 D&I 解题报告
鞍山现场赛结束了呢-- 我们出的是D+E+I三道题-- 吾辈AC掉的是D和I两道,趁着还记得.先在这里写一写我写的两道水题D&I的解题报告吧^_^. D题的意思呢是说星云内有一堆排成一条直线的 ...
- Substrings 第37届ACM/ICPC 杭州赛区现场赛C题(hdu 4455)
http://acm.hdu.edu.cn/showproblem.php?pid=4455 https://icpcarchive.ecs.baylor.edu/index.php?option=c ...
- 2014 ACM/ICPC 鞍山赛区网络赛(清华命题)
为迎接10月17号清华命题的鞍山现场赛 杭电上的题目 Biconnected(hdu4997) 状态压缩DP Rotate(hdu4998) 相对任一点的旋转 Overt(hdu4999 ...
- hdu 4431 第37届ACM/ICPC 天津赛区现场赛A题 枚举
题意:就是给了13张牌.问增加哪些牌可以胡牌.m是数字,s是条,p是筒,c是数字 胡牌有以下几种情况: 1.一个对子 + 4组 3个相同的牌或者顺子. 只有m.s.p是可以构成顺子的.东西南北这样 ...
- hdu 4438 第37届ACM/ICPC 天津赛区现场赛H题
题意:Alice和Bob两个人去打猎,有两种(只)猎物老虎和狼: 杀死老虎得分x,狼得分y: 如果两个人都选择同样的猎物,则Alice得分的概率是p,则Bob得分的概率是(1-p): 但是Alice事 ...
- zoj 3659 第37届ACM/ICPC 长春赛区现场赛E题 (并查集)
题意:给出一棵树,找出一个点,求出所有点到这个点的权值和最大,权值为路径上所有边权的最小值. 用神奇的并查集,把路按照权值从大到小排序,然后用类似Kruskal的方法不断的加入边. 对于要加入的一条路 ...
- 2017 ACM/ICPC 南宁区 网络赛 Overlapping Rectangles
2017-09-24 20:11:21 writer:pprp 找到的大神的代码,直接过了 采用了扫描线+线段树的算法,先码了,作为模板也不错啊 题目链接:https://nanti.jisuanke ...
随机推荐
- 2015蓝桥杯五星填数(C++C组)
题目:五星填数 如[图1.png]的五星图案节点填上数字:1~12,除去7和11.要求每条直线上数字和相等.如图就是恰当的填法.请你利用计算机搜索所有可能的填法有多少种.注意:旋转或镜像后相同的算同一 ...
- Python——详解__str__, __repr__和__format__
本文始发于个人公众号:TechFlow,原创不易,求个关注 今天是Python专题的第10篇文章,我们来聊聊Python当中的类. 打印实例 我们先从类和对象当中最简单的打印输出开始讲起,打印一个实例 ...
- C语言实现顺序表(顺序存储结构)
顺序表(顺序存储结构)及初始化过程详解 顺序表,全名顺序存储结构,是线性表的一种.通过<线性表>一节的学习我们知道,线性表用于存储逻辑关系为"一对一"的数据,顺序表自然 ...
- Struts2-学习笔记系列(13)-类型转换异常和校验器
Struts2框架有默认的类型转换错误拦截机制,该配置在struts-default.xml中,名叫conversionError,但是想使用需要继承ActionSupport. 默认的错误提示信息是 ...
- Codeup 25609 Problem I 习题5-10 分数序列求和
题目描述 有如下分数序列 2/1,3/2,5/3,8/5,13/8,21/13 - 求出次数列的前20项之和. 请将结果的数据类型定义为double类型. 输入 无 输出 小数点后保留6位小数,末尾输 ...
- AJ学IOS 之tableView的下拉放大图片的方法
AJ分享,必须精品 一:效果 tableview下拉的时候上部分图片放大会 二:代码 直接上代码,自己研究吧 #import "NYViewController.h" //图片的高 ...
- 编写高质量Python程序(三)基础语法
本系列文章为<编写高质量代码--改善Python程序的91个建议>的精华汇总. 关于导入模块 Python的3种引入外部模块的方式:import语句.from ... import ... ...
- 21-Java-Hibernate框架(一)
一.Hibernate了解 Hibernate框架是Java持久层的框架,是Gavin King发明的,2001年发布的,JBoss公司的产品,2003年进入市场. Hibernate是基于对象来操作 ...
- 好玩的GeoGebra
目前,在网站上看到好多大牛写的信号方面的笔记,有很多好玩的gif好玩又让人能明白其中的原理,工欲善其事必先利其器,在写我的博客方面先来学一个好玩的数学软件吧. GeoGebra官网如图 它是一个小巧的 ...
- Rank of Tetris 杭电 拓扑排序加并查集
自从Lele开发了Rating系统,他的Tetris事业更是如虎添翼,不久他遍把这个游戏推向了全球. 为了更好的符合那些爱好者的喜好,Lele又想了一个新点子:他将制作一个全球Tetris高手排行榜, ...