万年历制作
摘要:#include#includeusing namespace std;void printMonth(int year, int month);void printMonthTitle(int year, int month);void printMonthName(int month);void...
阅读全文
posted @
2014-04-28 23:20
左手代码右手诗
阅读(1087)
推荐(0)
嵌套链表的实现
摘要:You guys must have seen nested list (嵌套链表) such as [1, 2, 3, [4, 5, [6, 7]], 8, [9, 0]].So your task is to improve DouList with nested feature. You ca...
阅读全文
posted @
2014-04-24 22:39
左手代码右手诗
阅读(797)
推荐(0)
PY的宝藏
摘要: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
左手代码右手诗
阅读(145)
推荐(0)
Hard GCD and LCM
摘要:对于两个整数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
左手代码右手诗
阅读(148)
推荐(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
左手代码右手诗
阅读(745)
推荐(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
左手代码右手诗
阅读(565)
推荐(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
左手代码右手诗
阅读(118)
推荐(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
左手代码右手诗
阅读(174)
推荐(0)
卡片游戏
摘要:Description桌上有一叠牌,从第一张牌(即位于顶面的牌)开始从上往下依次编号为1~n。当至少还剩两张牌时进行以下操作:把第一张牌扔掉,然后把新的第一张放到整叠牌的最后。输入n,输出每次扔掉的牌,以及最后剩下的牌。Input第一行为一个整数t(0int main(){int test, n, ...
阅读全文
posted @
2014-04-18 22:31
左手代码右手诗
阅读(184)
推荐(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
左手代码右手诗
阅读(664)
推荐(0)
双头链表的实现
摘要:// List.h#ifndef SSCPP2014_DOULIST_A_H#define SSCPP2014_DOULIST_A_H#includestructDouListNode{int elem;DouListNode*prev,*next;DouListNode(int e =0,DouListNode*p =0,DouListNode*n =0){ elem = e; prev = p; next = n;}};classDouList{private:DouListNode*m_head,*m_tail;public:DouList();DouList(constDouList&
阅读全文
posted @
2014-04-10 21:08
左手代码右手诗
阅读(545)
推荐(0)