2014年4月18日
摘要: Description有一天, PY找到了一张藏宝图.这张地图被划分成2^n * 2^n个格子.左上角的格子的坐标为(0, 0)而右下角格子的坐标为(2^n-1, 2^n-1).如下:(0, 0)(0, 1)……(0, 2^n-1)……………………(2^n-2, 0)(2^n-2,1)……(2^n-... 阅读全文
posted @ 2014-04-18 22:39 左手代码右手诗 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 对于两个整数G和L(1#include#includeint main(){int d[10000];int T, G, L, ans, i, num; scanf("%d\n",&T);while(T--){ memset(d,0,sizeof(d)); num =0; scanf("%d %d"... 阅读全文
posted @ 2014-04-18 22:37 左手代码右手诗 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Description概念1:梅森数,当一个正整数可以表示成2p-1形式,且p为素数时,2p-1即称为梅森数概念2:在自然数中,只有1和它本身两个约数的数叫做素数。一个梅森数被称为梅森素数当且仅当它是一个素数。现给定一个正整数p(pint prime(int x){longlong i;if(x <... 阅读全文
posted @ 2014-04-18 22:36 左手代码右手诗 阅读(680) 评论(0) 推荐(0) 编辑
摘要: You'll be given two intergers. The number of the digits of each is from 1 to 200, inclusive. And what you need to do is to culcalate the product of th... 阅读全文
posted @ 2014-04-18 22:35 左手代码右手诗 阅读(537) 评论(0) 推荐(0) 编辑
摘要: Given a b and p, output (a^b) % p (2#include#includeint quick_power(int a,int b,int p){int temp;if(b ==0){return1;} temp = quick_power(a, b /2, p);if(... 阅读全文
posted @ 2014-04-18 22:33 左手代码右手诗 阅读(112) 评论(0) 推荐(0) 编辑
摘要: ConstraintsTime Limit: 1 secs, Memory Limit: 8 MBDescriptionInput A and B, output A+BInputInput two values, A and B.(0#includevoid init(int*arr,int*le... 阅读全文
posted @ 2014-04-18 22:32 左手代码右手诗 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description桌上有一叠牌,从第一张牌(即位于顶面的牌)开始从上往下依次编号为1~n。当至少还剩两张牌时进行以下操作:把第一张牌扔掉,然后把新的第一张放到整叠牌的最后。输入n,输出每次扔掉的牌,以及最后剩下的牌。Input第一行为一个整数t(0int main(){int test, n, ... 阅读全文
posted @ 2014-04-18 22:31 左手代码右手诗 阅读(175) 评论(0) 推荐(0) 编辑
摘要: F[0]=0;F[1]=1;F[n]=F[n-1]+F[n-2], for n>1给出n (0#include// 矩阵快速幂void xx(longlong a[][3],longlong b[][3],longlong m){longlong tmp[3][3]; tmp[1][1]= tmp[... 阅读全文
posted @ 2014-04-18 22:29 左手代码右手诗 阅读(648) 评论(0) 推荐(0) 编辑