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
2 2 2
2 1 3
10 1000 24
Sample Output
1
2
7
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)的更多相关文章

  1. CSU - 1530 Gold Rush —— 二进制

    题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1530 对于一块2^n质量的gold.需要把它分成a质量和b质量(a+b=2^n),且 ...

  2. 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 ...

  3. SIP SDP RTSP RTP RTCP webrtc

    rfc1889  rfc2326  rfc3261  rfc3550  rfc3856  rfc6120. SIP SDP RTSP  RTP RTCP,就像他们出现的顺序一样,他们在实际应用中的启用 ...

  4. BBC票选出的100部最经典美国电影,你看过几部?

    BBC票选出的100部最经典美国电影,你看过几部? 导读:BBC票选出的100部最经典美国电影,你看过几部? 2015-07-27欧美内参欧美内参欧美内参 微信号zoujinoumei 功能介绍< ...

  5. The 10 Best Neighborhoods in Seattle

    https://www.seattlemet.com/articles/2015/4/24/the-10-best-neighborhoods-in-seattle-may-2015 By Darre ...

  6. Training Neural Networks: Q&A with Ian Goodfellow, Google

    Training Neural Networks: Q&A with Ian Goodfellow, Google Neural networks require considerable t ...

  7. 吐血推荐250部必看电影下载 IMDB TOP 250 download

    中文名: IMDB Top 250合辑 TLF-MiniSD收藏版英文名: IMDB Top 250 TLF-MiniSD Collection版本: (更新至TOP119)[MiniSD]发行日期: ...

  8. 只用120行Java代码写一个自己的区块链-3挖矿算法

    在本系列前两篇文章中,我们向大家展示了如何通过精炼的Java代码实现一个简单的区块链.包括生成块,验证块数据,广播通信等等,这一篇让我们聚焦在如何实现 PoW算法. 大家都无不惊呼比特币.以太坊及其他 ...

  9. Dawson City【道森市】

    Dawson City Cities usually have a good reason for being where they are, like a nearby port or river. ...

随机推荐

  1. TextBox Ctrl+A不能全选的问题

    问题: 当TextBox控件在设置了MultiLine=True之后,Ctrl+A 无法全选,十分影响使用体验. 对于这个问题不明所以,不知道是Bug,还是故意而为之... 解决1: 添加KeyDow ...

  2. EF使用MySql DBFirst产品的问题总结

    一.实体数据模型向导->新建连接->更改数据源  找不到MySql Batabase选项. 解决:需求安装以下两个插件(mysql官网都可以找到)(注意版本,后面会讲到) 1.MySql ...

  3. JQuery - 阻止回车键

    JQuery 和 js 禁止enter回车事件方法 jQuery版 $(window).keydown( function(e) { var key = window.event?e.keyCode: ...

  4. JQuery Mobile - 解决页面点击时候,页眉和页脚消失问题!

    当点击页面时候,页眉和页脚会消失!解决方法,在页面和页脚中加入: data-quicklinks="true" 实际使用代码: <div data-role="pa ...

  5. tomcat设置默认欢迎页、server.xml配置文件中的标签理解

    一:要求:输入网址,不加文件名便可以访问默认页面 (1)项目中只有静态文件 方法:更改tomcat下的conf目录下的web.xml文件,如下图: <welcom-file-list>元素 ...

  6. [Leetcode]303.区域和检索&&304.二维区域和检索

    题目 1.区域和检索: 简单题,前缀和方法 乍一看就觉得应该用前缀和来做,一个数组多次查询. 实现方法: 新建一个private数组prefix_sum[i],用来存储nums前i个数组的和, 需要找 ...

  7. 08-03 java 继承

    继承格式,优缺点,概述: /* 继承概述: 把多个类中相同的内容给提取出来定义到一个类中. 如何实现继承呢? Java提供了关键字:extends 格式: class 子类名 extends 父类名 ...

  8. python _、__、__xx__之间的差别

    默认情况下,Python中的成员函数和成员变量都是公开的(public),在python中没有类public,private等关键词来修饰成员函数和成员变量.其实,Python并没有真正的私有化支持, ...

  9. 通俗易懂详解Java代理及代码实战

    一.概述 代理模式是Java常用的设计模式之一,实现代理模式要求代理类和委托类(被代理的类)具有相同的方法(提供相同的服务),代理类对象自身并不实现真正的核心逻辑,而是通过调用委托类对象的相关方法来处 ...

  10. sql字符处理

    --Description: 字符处理 --使用: 放到查询分析器里执行就可以了 --示例: select * from dbo.splitstr('12 44 45 50 56 87',' ') o ...