摘要:scanf很快但是getchar更快~输入挂(有时能用上):1 int read(){2 int res = 0;3 char c;4 while(c=getchar(), c'9');5 res = c-'0';6 while( c=getchar(),c>...
阅读全文
posted @ 2015-05-31 22:50
|
||
随笔分类 - 优化技巧总结
摘要:scanf很快但是getchar更快~输入挂(有时能用上):1 int read(){2 int res = 0;3 char c;4 while(c=getchar(), c'9');5 res = c-'0';6 while( c=getchar(),c>...
阅读全文
posted @ 2015-05-31 22:50
摘要:题目链接:http://poj.org/problem?id=1385题目大意:给你一个多边形的点,求重心。首先,三角形的重心: ( (x1+x2+x3)/3 , (y1+y2+y3)/3 )然后多边形的重心就是将多边形划分成很多个三角形,以三角形面积为权值,将每个三角形的重心加权平均。注意:pai...
阅读全文
posted @ 2015-01-24 14:19
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5113题目大意:给你N*M的棋盘,K种颜色,每种颜色有c[i]个(sigma(c[i]) = N*M),现在给棋盘染色,使得相邻的两个棋盘染成不同的颜色,并且把所有颜色用完。因为棋盘最大为5*5的,因此可...
阅读全文
posted @ 2014-11-29 22:35
摘要:题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1008题目大意:给你n*n的矩阵,每个格子里有4个三角形,分别是上右下左,每个三角形里面标记了数字,问你能否通过移动这n*n个格子,使得相邻两个三角形具有相同的数字?...
阅读全文
posted @ 2014-11-13 13:21
|
||