CSU 规律题
来源:互联网 发布:mac格式化重装系统 编辑:程序博客网 时间:2024/04/27 02:04
Description
Input
Output
Sample Input
32 2 22 1 310 1000 24
Sample Output
127
HINT
Source
根据题意,看一个数可以分多少次才可以到达 a和b的 值
#include <iostream>#include <algorithm>#include <cstdio>#include<cmath>#include <cstring>#include <cstdlib>#include <map>#define inf 0x3f3f3f3f#define Max 20010using namespace std;int main(){ int T; long long a,b,n,sum=0; while(~scanf("%d",&T)) { while(T--) { scanf("%lld%lld%lld",&n,&a,&b); if(a>b) swap(a,b); sum=pow(2,n); long long num=0; while(1) { if(a%sum==0) { break; } else { num++; sum/=2; } } printf("%lld\n",num); } }}
1535: Pizza voting
Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 522 Solved: 192
[Submit][Status][Web Board]
Description
Input
Output
Sample Input
5 2500 Margherita600 Salami700 Hawai800 Speciale900 Doener
Sample Output
YES
HINT
Source
//将每种情况都手写一遍,查找规律题意是A喜欢能量最少的,B喜欢能量最大的.所以每次A先选能量最大的排除掉,然后B选能量最小的除掉,然后该我聪明的选一个排除,多次循环后,使你选的号码保留到最后.#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include <cstdlib>using namespace std;int main(){ int n,m; char s[1000]; int a; while(~scanf("%d%d",&n,&m)) { for(int i=0;i<n;i++) { scanf("%d%s",&a,s); } if(n/3<m&&m<=(n/3+(n-1)/3)+1) printf("YES\n"); else printf("NO\n"); } return 0;}
0 0
- CSU 规律题
- CSU OJ:1318 Small change(规律)
- CSU 1972: 大梵天的恩赐 <递推,找规律>
- 【规律题】
- 规律题
- 规律题
- csu 入门题 棋局
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- CSU
- Android——在一个Activity中如何启动另外一个Activity
- json parser
- linux 定时任务
- 画一画javascript原型链
- Objective-C 编码规范(一)
- CSU 规律题
- EL表达式
- X86架构下SSE系列指令使用
- 招商银行支付时WebView无法加载证书
- Dispatcher类 url自动调度
- The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
- GPU渲染管线与shader
- Android Tips
- codeforces 584D Dima and Lisa