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. EMACS快捷键

    C = Control M = Meta = Alt | Esc Del = Backspace 基本快捷键(Basic) C-x C-f "find"文件, 即在缓冲区打开/新建 ...

  2. 【react】关于react框架使用的一些细节要点的思考

    ( _(:3 」∠)_给园友们提个建议,无论是API文档还是书籍,一定要多看几遍!特别是隔一段时间后,会有意想不到的收获的)   这篇文章主要是写关于学习react中的一些自己的思考:   1.set ...

  3. 小记 ArchLinux 下 Typora 无法输入中文

    今天准备写一篇 Linux 下的打印机文章,打开 Typora 时我发现不管我怎么设置都无法输入中文. pacman -R typora pacman -S typora 重新安装是无效的,我突然想起 ...

  4. 套接字:Socket

    在进行通信之前,一般要先建立Socket连接,Socket编程是端到端的通信,往往意识不到中间经过了多少局域网,多少路由器,他能操作的是端到端协议之上的网络层和传输层. 在网络层,Socket函数可以 ...

  5. html-文件上传设置accept类型延时问题

       今天在做文件上传时,采用了jQuery的upload插件,使用过程中发现了一个很有意思也很头疼的问题. 上传按钮,第一次点击时瞬间就可以打开文件选择框,之后再点击则需要等待恐怖的8s以上. 百度 ...

  6. POJ 2845

    #include <iostream> #include <string> #include <algorithm> #define MAXN 350 using ...

  7. Eclipse个人规范化设置

    为保证在各个在各个系统中获得的代码样式保持一致,规范法化开发,对Eclipse进行一些常用通用设置: 1. 代码块缩进 4个空格,如果使用 tab缩进,请设置成 1个 tab为 4个空格.(阿里巴巴开 ...

  8. mysql基础知识(2)

    十 一.计算字段 计算字段通常需要使用 AS 来取别名,否则输出的时候字段名为计算表达式 select col1*col2 as col12 from mytable concat() 用于连接两个字 ...

  9. 大叔来说说Markdown的使用

    强调和高亮背景 中国是伟大的民族! Highlight 中国是`伟大`的民族! ==Highlight== 链接 大叔博客园 [大叔博客园](http://www.cnblogs.com/lori & ...

  10. POJ 2083 Fractal 分形题目

    这两天自学了一线算法导论里分治策略的内容,秉着只有真正投入投入编程,才能更好的理解一种算法的思想的想法,兴致勃勃地找一些入门的题来学习. 搜了一下最后把目光锁定在了Poj fractal这一个题上.以 ...