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 ...
随机推荐
- mpvue微信小程序怎么写轮播图,和官方微信代码的差别
目前用mpvue很多第三方的ui库是引入不了的,因为它不支持含有dom操作. 那我们要做轮播图的话一个是手写另外一个就是用小程序的swiper组件了: 官方代码: <swiper indicat ...
- 基于 Spring Cloud 的微服务架构实践指南(下)
show me the code and talk to me,做的出来更要说的明白 本文源码,请点击learnSpringCloud 我是布尔bl,你的支持是我分享的动力! 一.引入 上回 基于 S ...
- Android Visibility控件显示和隐藏
Android控件显示和隐藏 visibility 可见(visible) XML文件:android:visibility="visible" Java代码:view.setVi ...
- MySQL入门,第八部分,多表查询(一)
一.数据库脚本 #-------------------------------------------------------------------------------- #--------- ...
- javascript 入门 之select2选择本地数据
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"/> <meta lan ...
- Python Requests-学习笔记(7)-Cookies
如果某个响应中包含一些Cookie,你可以快速访问它们: url = 'http://example.com/some/cookie/setting/url' r = requests.get(url ...
- Lua 5.3 -- SOL2.0 用户指南 【2】
系列教程指南[1] 注意 在你学习了sol的基础知识之后,建议你如果认为某些东西可以运行,你应该尝试一下.它可能会运行! 以下所有代码均可在sol2教程示例中找到. 断言/先决条件 The imple ...
- 一个不错的intellj 相关的博客
http://my.oschina.net/lujianing/blog?catalog=3300430
- 熬夜整理出来的干货:Python+Pycharm+PyQT5可视化程序设计入门
前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 作者:朱淑强 PS:如有需要Python学习资料的小伙伴可以加点击下方链接自 ...
- 如何用python爬虫从爬取一章小说到爬取全站小说
前言 文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取http ...