记录编号 |
347733 |
评测结果 |
A |
题目名称 |
[UVa 679]小球下落 |
最终得分 |
100 |
用户昵称 |
浮生随想 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.001 s |
提交时间 |
2016-11-13 15:53:51 |
内存使用 |
0.00 MiB |
显示代码纯文本
- #include<cstdlib>
- #include<cstdio>
- #include<cstring>
- #include<iostream>
- #include<algorithm>
- #include<queue>
- using namespace std;
- #define maxn 2000010
- #define ll long long
- #define END fclose(stdin);fclose(stdout);return 0;
- int read(){
- int x,f=1;
- char ch;
- while(ch=getchar(),!isdigit(ch))if(ch=='-')f=-1;
- x=ch-'0';
- while(ch=getchar(),isdigit(ch))x=x*10+ch-'0';
- return x*f;
- }
- int main(){
- freopen("fballs.in","r",stdin);
- freopen("fballs.out","w",stdout);
- int t;
- scanf("%d",&t);
- while(t--){
- int n,m,pos=1;
- scanf("%d%d",&n,&m);
- n--;m--;
- for(int i=1;i<=n;i++){
- if(m%2==0){
- pos=pos*2;
- }
- else pos=pos*2+1;
- m>>=1;
- }
- printf("%d\n",pos);
- }
- scanf("%d",&t);
- //while(1);
- END
- }