摘要:
Problem Description有N个比赛队(1#include#includeint indegree[505],map[505][505];//indegree记录每个节点的入度和。map记录那些边是相关联的int tp[505],k;//记录拓扑序列。void topsort(int n... 阅读全文
摘要:
Problem Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N... 阅读全文
摘要:
Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile... 阅读全文
摘要:
Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rec... 阅读全文
摘要:
Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge wants to do some operations on the hook.Let us number the consecutive metallic stick 阅读全文
摘要:
Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4)Your task is to take a number as input, and print that Fibonacci number 阅读全文
摘要:
Problem DescriptionFibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3。计算第n项Fibonacci数值。Input输入第一行为一个整数N,接下来N行为整数Pi(1#includeint m=10000;struct bignum{ int s[100]; int l;}f[1001];bignum operator+(bignum a,bignum b){ int i,d=0; if(b.l0;i--) printf("%04d",a.s[i]); printf("\n");} 阅读全文
摘要:
Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process to the end of file.OutputFor each N, output N! in one line.Sample Input123Sample Output126高精度运算#include#includeint m=10000;struct bignum{ int s[20001];//存放结果 int l;//数组的长度}a;bignum... 阅读全文
摘要:
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以Tidy要随时向Derek汇报某一段连续的工兵营地一共有多少人,例如Derek问:“Tidy,马上汇报第3个营地到第10个营地共有多少人!”Tidy就要马上开始计算 阅读全文
摘要:
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a typedef struct{ int l,r; int count;//记录这段线段的数目}point;point tree[300001];int ans;void build(int v,int l,int r)//建树{ tree[v].l=l; tree[v].r=r; tree[v].count=0; if(l==r) return ; int mid=(l+r)/2; build(2*v,l,mid); ... 阅读全文