Revival's odd
来源:互联网 发布:无线传感器网络概念 编辑:程序博客网 时间:2024/06/03 05:45
11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1......................................
- the n-th line contains n +1 values (begin from line 0)
- for the k-th value in the n-th line(n>=1)
- When k = 1 or k = n +1 its value is 1
- When k! = 1 and k! = n +1 its value is the sum of the k-1th value in the n-1-th line and the k-th value in the n-1-th line
Input
Output
Sample Input
1 12 2
Sample Output
1 20 2
#include<iostream>using namespace std;int odd(int n,int k){ return k==(n&k);}int main(){ int k; long n,sum; while(cin>>n>>k) { printf("%d ",odd(n,k-1)); sum=1; while(n>=2) { sum*=n%2+1; n=n/2; } if(n>0) sum*=n+1; printf("%ld/n",sum);
} return 0;}
好险,时间居然是0.98s,差一点点,呵呵
- Revival's odd
- FZU 1627Revival's road
- FZU 1627 Revival's road
- FZU 1627Revival's road
- Revival
- FZU 1627 Revival's road【DP(矩阵快速幂)】
- 当x有奇数个1时返回1,retrun 1 when x contains an odd number of 1s
- ICS Return 1 when x contains an odd number of 1s,0 otherwise(判断二进制表示中1的个数是否为奇数)
- uva10783 Odd Sum
- Even Or Odd?
- OR(odd ratios)
- UVa 10783 - Odd Sum
- LightOJ 1300 - Odd Personality
- Odd man out
- UVA 10783 - Odd Sum
- UVa 10783-Odd Sum
- Zero Power ODD
- Odd Even Linked List
- Windows群集安装:1)安装前的准备工作
- IP Address Control 控件的使用
- 医院门诊收费系统——能值多少钱?
- [C学习]循环控制
- c#.net常用函数列表
- Revival's odd
- 读书眼镜
- oracle分析函数row_number
- C#采集数据类(转)
- 台资企业管理职的中英文称谓以及级别
- MySQL的一些注意事项
- asp播放器源码
- CMD命令
- Put Scripts at the Bottom