自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(29)
  • 收藏
  • 关注

转载 中断向量类型表

中断向量类型表                         中断类型                              功能                                                      一                   CPU中断类型                            0

2013-12-17 12:50:13 1410

原创 Codeforces Round #100 / 140A (简单几何)

http://codeforces.com/contest/140/problem/A过大圆圆心作小圆切线即可发现规律,详见代码。注意判相等一定要用fabs!!!完整代码:/*30ms,0KB*/#includeusing namespace std;int main(){ int n, R, r; double a; scanf("%d%d%d"

2013-12-08 15:31:03 1247 5

原创 UVa 10360 Rat Attack (枚举&优化)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1301由于格子数远大于鼠窝,所以以鼠窝为出发点,增加鼠窝周围d范围内的“格子的值”,最后扫描每个格子输出最大格子值即可。完整代码:/*0.125s*/#

2013-12-07 10:36:33 1157

原创 UVa 10545 Maximal Quadrilateral (有内切圆的四边形面积)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1486公式参考维基百科完整代码:#include#includeint main(){ int t, cas = 0, p, a, b; d

2013-12-06 22:26:43 893

原创 UVa 471 Magic Numbers (枚举)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=412直接枚举。代码中给出了一个用位运算判断数字中是否有重复数字的方法。完整代码:/*0.032s*/#include const long long

2013-12-06 22:01:16 919

原创 UVa 11042 Complex, difficult and complicated (一个常数很小的O(1)解决方法)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1983与复数的幂次有关的题,首先从几何角度考虑,一个复数能否绕原点逆时针旋转k*arctan(b/a)次后变为实数?(复数幂的几何性质)(这里先特判一下,当a=0时,很

2013-12-06 20:01:52 1443

原创 UVa 1346 Songs (贪心好题)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=4092思路:直接看这个和式,记A(i)=f(i)Σl(j) (1设sum已经达到最小,记sum1 = A(i)+A(i+1) = (f(i)+f(i+1))*(

2013-12-06 13:06:53 1257

原创 UVa 10012 How Big Is It? (枚举&细节)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=953思路:最多8个球,直接枚举。注意:1. 由于一个圆不一定与圆心横坐标与其横坐标最接近的圆相切,所以判断一个圆圆心横坐标的实际位置要一一比较在

2013-12-05 22:55:38 1162

原创 UVa 11703 sqrt log sin (DP)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2750不用加eps了,floor才是神器!完整代码:/*0.382s*/#include#includeconst int mod = 100000

2013-12-05 16:10:48 1161

原创 UVa 893 Y3K Problem (用GregorianCalendar类秒杀)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=834不解释。完整代码:import java.util.*;import java.io.*;public class Main { static

2013-12-05 12:50:30 1078

转载 JAVA日期处理类总结:Date/Calendar/GregorianCalendar/DateFormat/SimpleDateFormat类

1、         Date类(该类现在很少用了)l         Date类对象的创建: n         创建一个当前时间//默认是创建一个代表系统当前日期的Date对象  Date d = new Date();n         创建一个我们指定的时间的Date对象:下面是使用带参数的构造方法,可以构造指定日期的Date类对象,Date类中年份的参数应该是

2013-12-05 12:30:22 1168

原创 UVa 10176 Ocean Deep ! - Make it shallow !! (模性质)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1117思路和UVa 11344是一样的完整代码:/*0.019s*/#includeint main(){ int mod; char c

2013-12-05 12:15:16 1174

原创 UVa 11344 The Huge One (模性质)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2319简单点的方法:由于a*10%m=((a%m)*10)%m,所以一个数一个数挨个取模判断即可。复杂点的方法:1. 1不用判断。2. 若一个整数的未尾三位数能

2013-12-05 10:30:10 2256

原创 UVa 496 Simply Subsets (STL&set_intersection)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=437先介绍头文件中与集合运算有关的4个函数:set_unionUnion of two sorted ranges (并集:A∪B)set_inte

2013-12-04 20:53:06 1977

原创 UVa 11028 Sum of Product (A007773,你懂的)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1969算了前几个发现是A007773还给出了个公式:当n>=7, a(n) = (n^3-16n+27)/6 (n是奇数); (n^3-16n+30)/6 (n是偶

2013-12-04 19:19:43 1155

原创 UVa 10162 Last Digit (数学规律)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=11031. 先看单个数的规律:0^n%10: 01^n%10: 12^n%10: 2,4,8,63^n%10: 3,9,7,14^n%10: 4,6

2013-12-04 18:02:52 1349

原创 UVa 12502 Three Families (想法题)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3946哈哈。考想法的一道题。首先注意到这句话:You may assume both families were cleaning at the same speed.

2013-12-03 19:21:37 920

原创 UVa 12036 Stable Grid (想法题)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3187表示想复杂了。。其实只要统计是否有一个数字出现大于n次就no啊orz完整代码:/*0.042s*/#include#includeint c

2013-12-03 18:12:45 970

原创 UVa 640 Self Numbers (类似素数筛)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=581if (!vis[i]) printf("%d\n", i);vis[d(i)] = true;完整代码:#includeconst int maxn =

2013-12-03 16:50:19 1311

原创 POJ 3761 Bubble Sort (用反序表分析排列数)

http://poj.org/problem?id=37611. 先介绍反序表的概念:令bi(1比如说,排列5 9 1 8 2 6 4 7 3有反序表2 3 6 4 0 2 2 1 0(在1左边且大于1的有2个,在2左边且大于2的有3个,……)2. 关键结论:由1知,第1个元素的反序数取值范围是[0,n-1],第i个元素的反序

2013-12-03 12:57:57 1727

原创 BNU 4208 Bubble sort (想法题)

http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=4208注意题目是让求趟数,所以比较原序列与排序后序列中位置相差最大的就是答案。完整代码:/*136ms,1408KB*/#include#includeusing namespace std;int a[10005], Map[10005];int mai

2013-12-03 08:53:26 909

原创 UVa 12004 Bubble Sort (想法题)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3155枚举交换次数算期望太麻烦,不妨换个思路:对于任意一对数字,它们之间发生交换的概率和不交换的概率是相等的,那这对数字提供的期望值就为1/2。总共有C(n,2)对数字,所以最终的期望值就为n*(

2013-12-03 08:33:19 1710

原创 UVa 10473 Simple Base Conversion (两句话实现进制转换)

10473 - Simple Base ConversionTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=141410->16:atoi+%X16->1

2013-12-02 01:20:55 1171

原创 UVa 10305 Ordering Tasks (拓扑排序模板)

10305 - Ordering TasksTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1246模板:/*0.022s*/#includeusi

2013-12-02 00:27:56 1399

原创 UVa 10168 Summation of Four Primes (“1+1+1+1”问题)

10168 - Summation of Four PrimesTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1109思路:既然1+1都在很大的数据范围内成

2013-12-01 22:45:53 1477

原创 UVa 10616 Divisible Group Sums (DFS&DP)

10616 - Divisible Group SumsTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1557思路:用DFS+记忆化搜索枚举组合,注意数字

2013-12-01 18:46:44 1007

原创 UVa 11181 Probability|Given (DFS&贝叶斯公式)

11181 - Probability|GivenTime limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=2122思路:拿样例一的“三选二”为例:

2013-12-01 16:33:02 1320

原创 UVa 10169 Urn-ball Probabilities ! (概率)

10169 - Urn-ball Probabilities !Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=115&page=show_problem&problem=1110看输出要求:The floating

2013-12-01 15:00:46 1208

原创 BNU 24192 Fruit Ninja (想法题)

http://www.acm.uestc.edu.cn/problem.php?pid=1639思路:这道题目的突破口在于以下两点:1. m,n都很小:1 2. 所有数都相同的几率非常小,尤其在分数很大的时候。换句话说,获得额外奖分n的情况很少。据此,优先分析获得额外奖分m的情况,也就是当得分是5的倍数的时候。我们从导致INF的情况入手:1. 当m是

2013-12-01 00:18:48 1673

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除