- 博客(14)
- 收藏
- 关注
原创 Goldbach`s Conjecture LightOJ - 1259
Goldbach`s Conjecture LightOJ - 1259Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:Every even integer, greater than 2, c
2017-08-14 19:49:25 265
原创 HDU - 1753 大明A+B
大明A+B HDU - 1753 话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。 这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。 现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。 Input本题目包含多组测试数据,请处理到文件结束。 每一组测试数据在一
2017-08-12 19:33:37 258
原创 HDU_3791 二叉搜索树
二叉搜索树判断两序列是否为同一二叉搜索树序列Input开始一个数n,(1接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。 接下去的n行有n个序列,每个序列格式跟第一个序列一样,请判断这两个序列是否能组成同一颗二叉搜索树。Output如果序列相同则输出YES,否则输出NO Sample Input
2017-08-07 19:33:38 275
原创 扩展欧几里得 以A/B HDU - 1576 为例
先说说欧几里得算法:其实就是辗转相除法,gcd(a,b)=gcd(b,a%b);代码表示为:int gcd(int a,int b) { if(b==0) return a; return gcd(b,a%b); } 再说说扩展欧几里得:其实就是找一堆整数(x,y),使得ax+by=gcd(a,b)。注意x和y不一定为正数,
2017-07-29 21:30:12 262
原创 Meteor Shower POJ - 3669
Meteor Shower POJ - 3669 Bessie hears that an extraordinary meteor shower is coming; reports say that these meteors will crash into earth and destroy anything they hit. Anxious for her s
2017-07-21 09:19:16 391
原创 Five-In-a-Row CodeForces - 825B
Five-In-a-Row CodeForces - 825B Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts cros
2017-07-20 19:32:11 315
原创 Find The Multiple POJ - 1426
find the most comfortable road HDU - 1598 XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure---超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的
2017-07-20 16:33:46 275
原创 HDU - 1272 小希的迷宫
HDU - 1272小希的迷宫上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路
2017-07-20 10:51:14 289
原创 POJ - 2395 Out of Hay(prim)
Out of HayThe cows have run out of hay, a horrible event that must be remedied immediately. Bessie intends to visit the other farms to survey their hay situation. There are N (2 <= N <= 2,000) f
2017-07-20 10:44:00 371
原创 poj-1456 Find The Multiple 深搜
Find The MultipleGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not gre
2017-07-20 09:59:42 197
原创 POJ-2031 最小生成树(prim算法)
POJ-2031Building a Space StationYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer
2017-07-18 21:29:53 285
原创 HDU-1879 最小生成树(Kruskal)模板题
HDU-1879继续畅通工程省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1
2017-07-18 21:24:09 677
原创 HDU - 1232 并查集模板题
畅通工程 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( 注意:两个城市之间可以有多条道路相通,也就
2017-07-18 21:20:34 195
原创 POJ-1751 最小生成树 (prim算法)
POJ-1751 HIGHWAYThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has al
2017-07-18 17:56:17 541
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人