zrq495
www.zrq495.com
摘要: 这几天正在搭个人博客,这个博客就不常更新了,新博客地址: www.zrq495.com 。欢迎光顾! 阅读全文
posted @ 2012-12-28 23:29 zrq495 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 接触ACM也快有一年了, 这一年学到了很多的东西,见识了各种的神牛、大牛、小牛,特别是这个暑假,很充实。虽然没有参加省赛和区域赛有些遗憾,但是对于我这样一个无名小卒来说,我已经很知足了。关于为什么退集训队,原因有很多,当然多数还是个人原因,没法说 ,也不想多说。以后的路还很长,无论怎么走都是走,反正不会让自己闲着。找找自己的兴趣和长处,踏实的学习一门技术,锻炼下自己的社交和处世能力。还有就是非常的感谢刘老师和学长们,谢谢你们的付出。希望留下来的队友们,继续努力,坚持,为学校争光!我也会继续努力。一起加油! 阅读全文
posted @ 2012-08-23 13:48 zrq495 阅读(274) 评论(0) 推荐(0) 编辑
摘要: UVa第一卷最后一题。求内部不含点并且面积最大的三角形。暴力。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 6 using namespace std; 7 8 typedef struct node 9 {10 char ch;11 int x, y;12 }node;13 14 node dot[20];15 16 double mianji(int i, int j, int k) //求三角形的面积17 {18 r 阅读全文
posted @ 2012-08-17 20:33 zrq495 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 凸包 + 枚举。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<cmath> 6 #include<algorithm> 7 8 using namespace std; 9 10 typedef struct node11 {12 int x, y;13 }node;14 15 node f[50002];16 17 bool cmp(node a,node b) //叉积排序 阅读全文
posted @ 2012-08-16 19:15 zrq495 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 围墙的周长= 凸包 周长+圆的周长。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 #include<cmath> 6 #include<algorithm> 7 8 #define PI 3.141592653 9 10 using namespace std;11 12 typedef struct node13 {14 int x, y;15 }node;16 17 node f[1002] 阅读全文
posted @ 2012-08-16 19:04 zrq495 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 额。。。貌似special judge,求一个数的四个不同因数。。。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int main() 7 { 8 int i, j, n, a, cas=1; 9 cin >> n;10 while(n--)11 {12 cin >> a;13 printf("Case #%d: %d", cas++, a);14 for (i=2,j=0; j<2; i++)15 ... 阅读全文
posted @ 2012-08-15 20:04 zrq495 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 求钟表的时针和分针之间的夹角。时针一小时转30度,一分钟转0.5度,分针一分钟转6度,减一下就行了。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int main() 7 { 8 int h, m; 9 double sum;10 while(scanf("%d:%d", &h, &m) && (h||m))11 {12 if (h == 12)13 h=0;14 sum=(h*30.0+m*1.0/... 阅读全文
posted @ 2012-08-15 19:38 zrq495 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 简单trie树。代码如下: 1 #include<iostream> 2 #include<string.h> 3 #include<cstdio> 4 #include<cstdlib> 5 6 using namespace std; 7 8 int n; 9 10 typedef struct node 11 { 12 int flag; 13 node *next[26]; 14 }node; 15 16 void strlwr(char *s) //大写转换小写 17 { 18 int i; 19 for (i=0; i<s... 阅读全文
posted @ 2012-08-14 14:23 zrq495 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Trie树 + 暴力。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cstdlib> 5 6 using namespace std; 7 8 char s[50002][100]; 9 10 typedef struct node 11 { 12 int flag; 13 node *next[26]; 14 }node; 15 16 node *newnode() //新节点 17 { 18 int i; 19 node *... 阅读全文
posted @ 2012-08-14 14:20 zrq495 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 作者:Dong | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址:http://dongxicheng.org/structure/trietree/1、 概述Trie树,又称字典树,单词查找树或者前缀树,是一种用于快速检索的多叉树结构,如英文字母的字典树是一个26叉树,数字的字典树是一个10叉树。Trie一词来自retrieve,发音为/tri:/ “tree”,也有人读为/traɪ/ “try”。Trie树可以利用字符串的公共前缀来节约存储空间。如下图所示,该trie树用10个节点保存了6个字符串tea,ten,to,in,inn,int:在该trie树中,字符. 阅读全文
posted @ 2012-08-12 20:52 zrq495 阅读(229) 评论(0) 推荐(0) 编辑
摘要: L=(Z*L + I)%M,求L的循环周期。注意L不一定是在初始位置开始循环。哈希 数组标记出现过的L,判断即可。代码如下: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 5 using namespace std; 6 7 int main() 8 { 9 long long a[10001], l, z, i, m, cnt, cas=1;10 while(cin >> z >> i >> m >> l, z||i||m||l)1 阅读全文
posted @ 2012-08-11 21:17 zrq495 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 判断是否互质数。注意输出格式。代码: 1 #include<iostream> 2 #include<cstdio> 3 4 using namespace std; 5 6 int gcd(int a, int b) //求最大公约数 7 { 8 return b? gcd(b, a%b) : a; 9 }10 11 int main()12 {13 int s, m;14 while(cin >> s >> m)15 {16 if (gcd(s, m) == 1)17 printf("%10d%10d ... 阅读全文
posted @ 2012-08-11 16:28 zrq495 阅读(203) 评论(0) 推荐(0) 编辑
摘要: DP。代码如下: 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 5 using namespace std; 6 7 int main() 8 { 9 int T, n, i, a, sum;10 int k, t, x, y, maxn;11 cin >> T;12 for (k=1; k<=T; k++)13 {14 t=1;15 sum=0;16 maxn=-1000;17 cin >> n;18 ... 阅读全文
posted @ 2012-08-10 19:29 zrq495 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 动态规划。可以自上到下,也可以自下到上。代码如下: 1 #include<iostream> 2 #include<cstring> 3 4 using namespace std; 5 6 int main() 7 { 8 int n, i, j, a[102][102]; 9 cin >> n;10 memset(a, 0, sizeof(a));11 for (i=1; i<=n; i++)12 for (j=1; j<=i; j++)13 cin >> a[i][j];14 for (i=n; i>=1... 阅读全文
posted @ 2012-08-10 19:27 zrq495 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 动态规划。代码如下: 1 #include<iostream> 2 #include<cstring> 3 4 using namespace std; 5 6 int main() 7 { 8 int i, j, n, a[1002], len[1002], max; 9 cin >> n;10 for (i=1; i<=n; i++)11 {12 cin >> a[i];13 }14 memset(len, 0, sizeof(len));15 len[1]=1;16 for (i=2; i<=n; i++... 阅读全文
posted @ 2012-08-10 19:24 zrq495 阅读(200) 评论(0) 推荐(0) 编辑