随笔分类 -  UvaOJ

UVa 10986 - Sending email
摘要:SPFA,2RE,无向图的边数为题目描述的两倍。# include <cstdio># include <cstring># include <queue>using namespace std;# define N 20000 + 5# define M (50000 + 5) * 2# define INF 550000000int n, m, src, des;int first[N], d[N];bool inq[N];int u[M], v[M], w[M], next[M];void read_graph(void){ scanf("% 阅读全文

posted @ 2012-07-23 14:42 getgoing 阅读(232) 评论(0) 推荐(0)

UVa 10986 Dijkstra TLE
摘要:时限是 3s, 当然不能用 dijksra;N 最大是 20005,数组 d[N][N] 可以开;------------------------------------------------------------------------# include <stdio.h># include <string.h># define N 20005# define M 50005# define INF N*Mint n, m, s, t;int w[N][N];int min(int x, int y){ return (x<y ? x:y);}void in 阅读全文

posted @ 2012-07-10 10:40 getgoing 阅读(228) 评论(0) 推荐(0)

UVa 620 - Cellular Structure
摘要:这道题重点在于理解题意,不是动态规划?(If an organism were in two stages of growth at the same time the first option from the list above should be given as an answer.):初始阶段微生物为A,有两种生长方式,一种是右边扩展“AB”,一种是最前面扩展“A”而最后面扩展“B”3;所以合法的微生物的长度都是奇数,然后再判断是否是以上三种阶段即可;参考了网上的分析。 1 # include <stdio.h> 2 # include <string.h> 阅读全文

posted @ 2012-04-13 14:01 getgoing 阅读(283) 评论(0) 推荐(0)

UVaOj 494 Kindergarten Counting Game
摘要:复习了the C programming language 中的单词记数/*494 - Kindergarten Counting Game*/# include <stdio.h># include <ctype.h># define IN 1# define OUT 0int main(){ int ans,state; char ch; ans = 0; state = OUT; while ((ch=getchar()) != EOF) { if (!isalpha(ch) && ch!='\n') state =... 阅读全文

posted @ 2012-02-19 13:39 getgoing 阅读(325) 评论(0) 推荐(0)

UVaOJ458 - The Decoder
摘要:看出来了,ascll -7WA:/*458 - The Decoder*/# include <stdio.h>int main(){ char ch; while ((ch=getchar()) != EOF) if (ch != '\n') putchar((ch+121)%128); else putchar('\n'); return 0;}AC:/*458 - The Decoder*/# include <stdio.h>int main(){ char ch; while ((ch=getchar()) != EOF) .. 阅读全文

posted @ 2012-02-19 12:35 getgoing 阅读(323) 评论(0) 推荐(0)

UVaOJ 10300 Ecological Premium
摘要:理解错误:Do not output any blank lines.注意: No integer in the input is greater than 100000 or less than 0./*10300 - Ecological Premium*/# include <stdio.h>int main(){ int n, f; long long s, a, e, ans; scanf("%d", &n); while (n > 0) { ans = 0; scanf("%d", &f); while (. 阅读全文

posted @ 2012-02-19 11:18 getgoing 阅读(328) 评论(0) 推荐(0)

UVaOJ10071 - Back to High School Physics
摘要:初速度与加速度恒定,已知经 t 时间后速度为 v, 求经 2t 后位移为多少?/*10071 - Back to High School Physics*/# include <stdio.h>int main(){ int v0, t; while (scanf("%d%d", &v0, &t)!=EOF) printf("%d\n",2*v0*t); return 0;} 阅读全文

posted @ 2012-02-19 10:34 getgoing 阅读(279) 评论(0) 推荐(0)

UvaOJ10055 hashmat the brave warrior
摘要:3WA。。。/* UVa10055 Hashmat */# include <stdio.h>int main(){ unsigned long a, b; while (scanf("%ld%ld", &a, &b) != EOF) printf("%ld\n", (a<b ? b-a:a-b)); return 0;} 阅读全文

posted @ 2012-02-19 10:10 getgoing 阅读(377) 评论(0) 推荐(0)

导航