- 博客(54)
- 收藏
- 关注
原创 zoj1163 The Staircases (简单dp)
The StaircasesTime Limit: 2 Seconds Memory Limit: 65536 KB One curious child has a set of N little bricks. From these bricks he builds different staircases. Staircase consists of steps
2013-02-26 17:09:36
426
原创 poj1002 487-3279(电话号码重复次数)
487-3279Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 205583 Accepted: 35862DescriptionBusinesses like to have memorable telephone numbers. One way to
2013-02-23 09:02:25
754
原创 zoj1239 Hanoi Tower Troubles Again!
Hanoi Tower Troubles Again!Time Limit: 2 Seconds Memory Limit: 65536 KB People stopped moving discs from peg to peg after they know the number of steps needed to complete the entire tas
2013-02-21 15:53:55
808
原创 poj3487 The Stable Marriage Problem(最稳定的婚姻)
The Stable Marriage ProblemTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1966 Accepted: 838DescriptionThe stable marriage problem consists of matching
2013-02-21 10:32:21
888
原创 uva10004 Bicoloring(交叉染色法)
题目:In 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors, in such a way that no region is color
2013-02-20 09:05:08
1035
原创 poj1523(无向图求割点)
SPFTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4085 Accepted: 1888DescriptionConsider the two networks shown below. Assuming that data moves around th
2013-02-19 10:21:23
1869
原创 poj1144-Network(求割点)
NetworkTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7278 Accepted: 3419DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable
2013-01-31 11:43:26
2817
原创 poj3114 Countries in War(强连通分量+最短路)
Countries in WarTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1757 Accepted: 553DescriptionIn the year 2050, after different attempts of the UN to mai
2013-01-28 20:49:48
1186
原创 poj2553-The Bottom of a Graph(强连通分量)
The Bottom of a GraphTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 7098 Accepted: 2905DescriptionWe will use the following (standard) definitions from g
2013-01-26 19:17:00
1276
原创 hdu 2767 Proving Equivalences(强连通分量)
Proving EquivalencesTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1426 Accepted Submission(s): 535Problem DescriptionConsider t
2013-01-26 11:15:04
478
原创 poj1236-network of schools(强连通分量)
Network of SchoolsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 8137 Accepted: 3221DescriptionA number of schools are connected to a computer network. A
2013-01-26 09:56:56
382
原创 CF—98A—Help Victoria the Wise
A. Help Victoria the Wisetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasilisa the Wise from a far away kingdom g
2013-01-26 09:43:41
813
原创 poj2186Popular Cows
牛群里的牛相互崇拜,这种崇拜是单向可传递的,要求最受崇拜的牛有几个,最受崇拜的牛是受其余所有牛的崇拜用tarjan算法完全抄袭的模板,写出来了还是各种转不出来#include#include#include#includeusing namespace std;int n,m;vector vec[100005];int vis[100005];int
2013-01-25 10:10:52
279
原创 hdu1272小希的迷宫
通过已给的路径判断每个顶点之间是否都能互相到达并且没有回路#include#includeusing namespace std;int f[100005];int v[100005];int mm;int find(int x){ int r=x; while(f[r]!=r) r=f[r]; f[x]=r;
2013-01-24 16:51:13
240
原创 最短路-find the safest road
#includedouble map[1005][1005];double a[1005];int v[1005];int main(){ int n,m; while(scanf("%d",&n)!=EOF) { for(int i=1; i { for(int j=1; j
2013-01-22 19:25:18
246
原创 最短路-1011
首先建图,给出的2n+1行字符串一行横着一行竖着,建好图直接dij#include#includeusing namespace std;int map[450][450];int a[450],v[450];int n,m;int poit;void buildMap(){ int a; char b; for(int i=0;
2013-01-22 19:19:54
277
原创 最短路-1010
Einbahnstrasse Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 17 Accepted Submission(s) : 5Problem DescriptionEinbahnstra e (German fo
2013-01-22 19:15:36
334
原创 最短路—1009
开始直接建图,超时,将图反过来建,一次Dij就可以了#include#includeusing namespace std;int n,m,s,w;int map[1005][1005];int a[1005],v[1005];int start[1005];void dij(){ int min,min_f,i,j; for(i=1; i
2013-01-22 19:13:42
307
原创 hdu1789
贪心算法,时间按从小到大排序,时间相同按分数从小到大排序 #include#include#includeusing namespace std;struct sa{ int x; //天数 int y; //分数} data[1000];int cmp(const sa &a,const sa &b){ if(a.x==b
2013-01-20 11:06:03
305
原创 最短路—1008
计算汇率,用Floyd,最后检查对角线上的树是不是大于1#include#includestruct node{ char name[30];} c[33];double map[33][33];int main(){ int n,m,i,j,k,cc=0; while(scanf("%d",&n)&&n!=0) {
2013-01-20 11:04:46
267
原创 最短路—1007
#includeint n,start,end;int map[205][205];int a[205],v[205];void dij(){ int i,j,min,min_f; for(i=1;i { a[i]=map[start][i]; v[i]=0; } v[start]=1;
2013-01-19 19:01:53
249
原创 2013寒假SD高校ACM周赛3—Steps
#includeint main(){ int n,a,b; scanf("%d",&n); while(n--) { scanf("%d%d",&a,&b); int s; s=b-a; int sum=0; int i=1; while(s
2013-01-19 18:18:18
231
原创 最短路—1006
#includeint map[1005][1005];int path[1005][1005];int charge[1005];int n;int main(){ int i,j,k,start,end; while(scanf("%d",&n)&&n!=0) { for(i=1;i for(j=
2013-01-19 14:02:08
277
原创 最短路—1005
#include#include#includeusing namespace std;vector road[1005];int n;int a[1005],map[1005][1005],v[1005];int s[1005];void dij(){ int i,j,min,min_f; for(i=1;i {
2013-01-19 14:01:41
331
原创 最短路—1004
#include#define inf 100000000int map[201][201];int a[201],v[201];int n,s,e;void dij(){ int i,j,min,min_f; for(i=0; i { a[i]=map[s][i]; v[i]=0; }
2013-01-12 22:47:09
486
原创 最短路—1003
指定开始和结束的位置,求最短路,要保存顶点#include#includestruct node{ char a[31];} bi[151];int poit;int map[151][151];int v[151],t[151];void dij(){ int i,j,min,min_f; for(i=0; i {
2013-01-12 22:45:26
220
原创 最短路—1002
很多条路 找到最短的#include#includeint map[101][101],n,a[101],v[101];void dij(){ int i,j,min,min_f=0; for(i=1;i { a[i]=map[1][i]; v[i]=0; } v[1]=1; for
2013-01-11 00:25:58
528
原创 最短路—1001
#include#includeint map[101][101],n,a[101],v[101];void dij(){ int i,j,min,min_f=0; for(i=1;i { a[i]=map[1][i]; v[i]=0; } v[1]=1; for(i=1;i
2013-01-11 00:24:48
323
原创 poj3624
01背包#include#includeint dp[12881];int w[3403],d[3403];int main(){ int n,m,i,j; scanf("%d%d",&n,&m); for(i=0;i scanf("%d%d",&w[i],&d[i]); memset(dp,0,sizeof(dp)
2012-12-18 12:04:36
346
原创 山东理工大学-2012秋季ACM集训队测试赛4-I-矩形回旋
有一个由 n*m(n是行数,m为列数) 的方格组成的矩形阵列。现在从左上角开始顺时针旋转走动,遇到矩形边框或者遇到已经过的方格就转向继续,直到走完所有方格。求最后结束点的坐标(横坐标位置从1到m,纵坐标从1到n)。 矩阵回旋,要比较输入的两个数的大小,按小的来走,然后判断小的的奇偶性。#includeint nn,mm;int p(int a,int b){
2012-12-08 18:12:51
611
原创 山东理工大学-2012秋季ACM集训队测试赛4-H-火星计数法
火星人的计数规则里只有a,b,c,d四个字母,计数规则从小到大是 a,b,c,d,aa,ab,ac,ad,ba,……。给出来由a,b,c,d四种字母组成的火星数字,算出该数字是第几个(从1开始)。 #include#include#includeint p(int x){ int sum=1,i; for(i=1;i sum=(sum*4)
2012-12-08 18:09:17
617
原创 山东理工大学-2012秋季ACM集训队测试赛4-F-多项式求和
多项式描述如下:1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 ……先请你求出多项式前n项的和。 当大于300的时候输出值不变#include#includeint main(){ int t,i,n; double sum; scanf("%d",&t); while(t--) {
2012-12-08 18:07:25
508
原创 NEFU-4-2-Center Alignment
把输入的所有句子居中放置,不能完全居中的一左一右放置,四周用*围满。#include#includestruct node{ char a[1001]; int l;} p[1001];int main(){ int i,j,k,n=0,max=0,mm,f=0; while(gets(p[n].a)) {
2012-12-04 22:30:54
300
原创 NEFU-4-1-Chat Server's Outgoing Traffic
#include#include#includeusing namespace std;char a[101];int main(){ int i,sum=0,pm=0; while(gets(a)) { if(a[0]=='+') { pm++; }
2012-12-04 22:26:50
322
原创 NEFU-3-C-Registration system
#include#includestruct node{ char a[33]; int f;}name[100005];int main(){ int i,j,n; scanf("%d",&n); int sum=0; for(i=0;i { char s[33];
2012-11-30 21:33:14
339
原创 NEFU-3-A-Watermelon
判断给出的数能不能分成两个偶数#includeint main(){ int i,n; while(scanf("%d",&n)!=EOF) { if(n%2) printf("NO\n"); else { if(n>2)
2012-11-30 21:30:54
276
原创 NEFU-2-C-Tic-tac-toe
错了无数遍竟然是因为判断的是'A'与'0'……#includeint map[3][3];int main(){ int i,j; int f1=0,f2=0; int s1=0,s2=0,s3=0; for(i=1; i { for(j=1; j { scanf("%c
2012-11-30 21:28:00
469
原创 10038 - Jolly Jumpers
判断给出的长度为n的数组相邻两个数的差值是不是从1到n-1。#include#includeint a[3001],b[3001];int main(){ int i,n,flag=0; while(scanf("%d",&n)!=EOF) { flag=0; memset(b,0,sizeof(b));
2012-11-29 22:54:57
348
原创 10137 - The Trip
#include#includedouble a[1000],sum,s1,s2;char tmp[1000];int main(){ int i,n; while(scanf("%d",&n)&&n!=0) { sum=0.0; s1=0.0; s2=0.0; for(i=0
2012-11-26 23:10:16
296
原创 10054 - The Necklace
给出n个珠子,珠子两边有不同的颜色,把珠子串起来,要求相邻珠子的颜色一样#include#includeint n,d[55],map[55][55];void dfs(int s){ int i; for(i=1;i { if(map[s][i]) { map[i][s]--;
2012-11-23 21:29:04
241
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人