Gold Rush(hnu13249)
| Gold Rush |
| Time Limit: 2000ms, Special Time Limit:5000ms, Memory Limit:65536KB |
| Total submit users: 15, Accepted users: 10 |
| Problem 13249 : No special judgement |
| Problem description |
|
Alice and Bob are on an adventure trip. Deep in the woods they discover a mysterious deep cave which they enter flutteringly. They find an old console with a giant bar of gold in it. On the bar, there is a number n. Both tried to carry the gold out the cave, but it was still to heavy for one of them. Suddenly a little fairy appears in the corner of the cave and approaches Alice and Bob: “This gold is heavy. It weights 2n femto-grams (10-15) and n can reach 62.” Bob answered: “What luck! Alice’s knapsack can carry up to a femto-grams and mine b femto-grams with a + b = 2n.” Alice interjected: “But how can we divide the gold?” Fairy: “I can help you with a spell that can burst one piece of gold into two equally weighted ones. But for each single spell, the cave will be locked one additional day.” Alice consults with Bob to use the help of the fairy and take all of the gold. How long will they be trapped if they are clever? |
| Input |
|
The input starts with the number t <= 1000 of test cases. Then t lines follow, each describing a single test case consisting of three numbers n, a and b with a, b >= 1, a + b = 2n, and 1 <= n <= 62. |
| Output |
|
Output one line for every test case with the minimal number of days that Alice and Bob are locked in the cave. |
| Sample Input |
3 |
| Sample Output |
1 |
| Problem Source |
| GCPC 2014 |
题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=13249&courseid=311
转载请注明出处:寻找&星空の孩子
#include<stdio.h>
#define LL __int64 LL a,b;
int main()
{
int n,T;
scanf("%d",&T);
while(T--)
{
scanf("%d%I64d%I64d",&n,&a,&b);
int p=,q=;
for(int i=;i<=n;i++)
{
if(a%)
{
p=i;
break;
}
a/=;
}
for(int i=;i<=n;i++)
{
if(b%)
{
q=i;
break;
}
b/=;
}
if(p<q)p=q;
printf("%d\n",n-p); }
return ;
}
Gold Rush(hnu13249)的更多相关文章
- CSU - 1530 Gold Rush —— 二进制
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1530 对于一块2^n质量的gold.需要把它分成a质量和b质量(a+b=2^n),且 ...
- 10 Best TV Series Based On Hacking And Technology
Technology is rapidly becoming the key point in human lives. Here we have discussed top TV shows whi ...
- SIP SDP RTSP RTP RTCP webrtc
rfc1889 rfc2326 rfc3261 rfc3550 rfc3856 rfc6120. SIP SDP RTSP RTP RTCP,就像他们出现的顺序一样,他们在实际应用中的启用 ...
- BBC票选出的100部最经典美国电影,你看过几部?
BBC票选出的100部最经典美国电影,你看过几部? 导读:BBC票选出的100部最经典美国电影,你看过几部? 2015-07-27欧美内参欧美内参欧美内参 微信号zoujinoumei 功能介绍< ...
- The 10 Best Neighborhoods in Seattle
https://www.seattlemet.com/articles/2015/4/24/the-10-best-neighborhoods-in-seattle-may-2015 By Darre ...
- Training Neural Networks: Q&A with Ian Goodfellow, Google
Training Neural Networks: Q&A with Ian Goodfellow, Google Neural networks require considerable t ...
- 吐血推荐250部必看电影下载 IMDB TOP 250 download
中文名: IMDB Top 250合辑 TLF-MiniSD收藏版英文名: IMDB Top 250 TLF-MiniSD Collection版本: (更新至TOP119)[MiniSD]发行日期: ...
- 只用120行Java代码写一个自己的区块链-3挖矿算法
在本系列前两篇文章中,我们向大家展示了如何通过精炼的Java代码实现一个简单的区块链.包括生成块,验证块数据,广播通信等等,这一篇让我们聚焦在如何实现 PoW算法. 大家都无不惊呼比特币.以太坊及其他 ...
- Dawson City【道森市】
Dawson City Cities usually have a good reason for being where they are, like a nearby port or river. ...
随机推荐
- ASP.NET MVC一次删除多笔记录 V2.0
前一段时间Insus.NET有写一篇<ASP.NET MVC一次删除多笔记录>http://www.cnblogs.com/insus/p/6241186.html 可以前往去看看. 觉得 ...
- DOM LEVEL 1 中的那些事儿[总结篇-下]
本文承接:DOM LEVEL 1 中的那些事儿[上] 2.3 Element类型 Element类型应该是Document类型之外使用的最多的节点类型了,Element代表XML或HTML文档中的 ...
- Spring IOC 容器源码分析 - 余下的初始化工作
1. 简介 本篇文章是"Spring IOC 容器源码分析"系列文章的最后一篇文章,本篇文章所分析的对象是 initializeBean 方法,该方法用于对已完成属性填充的 bea ...
- libffi-dev : 依赖: libffi6 (= 3.2.1-4) 但是 3.2.1-4kord 正要被安装
原文链接:https://blog.csdn.net/u013992330/article/details/85135629 中标麒麟安装python库:sshtunnel 的时候提示缺少ffi.h文 ...
- Yii2框架 数据库常用操作
通用: use yii\db\Query; $query = new Query(); 查询: Query: $rows = (new \yii\db\Query()) ->select(['c ...
- java 路径的问题
在项目开发中会碰到各种各样的获取项目路径的一些问题: 1:java项目: 以获取 类路径下的mess.properties 为例来说明: 文件在项目中的位置: src/bz/beppe/demo/r ...
- 【ElasticSearch】:QueryDSL
Search API URI Search Response Body Search Query DSL Response Body Search使用Query DSL语句,相对URI Search功 ...
- Synchronzied与ReentrantLock
- 《deep sort》复现过程
目录 1. 准备代码与数据 deep_sort开源代码 克隆到本地服务器 git clone https://github.com/nwojke/deep_sort.git 下载MOT16数据集(MO ...
- odoo开发笔记 -- odoo web机制浅析
http://blog.csdn.net/M0relia/article/details/39025947