自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(32)
  • 资源 (1)
  • 收藏
  • 关注

原创 杭电1072 Nightmare

Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb

2016-10-11 20:53:52 390

转载 poj 食物链

动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种说法是"2 X Y",表示X吃Y。 此人对N个动物,用上述两种说法,一句接一句地

2016-10-09 20:09:37 525

原创 Android项目中,在一个数据库里建立多张表

一,创建一个公共的DBAdapter;为了在整个程序运行期间调用该公共的数据库,我们定义了一个扩展自Application的CommDB类:1,创建唯一的数据库: 1 public class CommDB { 2 3 public static final String DATABASE_NAME = "myDatabase"; //数据库名称 4

2016-08-22 16:09:10 3214 1

原创 杭电1003(简单dp)

Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. 

2016-08-09 15:55:44 2760 1

原创 杭电1016(dfs)增所广收

A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of fi

2016-08-08 16:55:20 286

原创 大数加法

大数相加,要考虑是否进位,多位数相加的时候,用数组可能会爆,老师告诉我们可以用string来保留数组的作用,而且不会有位数的限制。道理都差不多,只是表示的方法不同。#include #include #include using namespace std;char mmm(char &x,char y,char z){ int A=x+y+z-3*48; x=A%10+'0

2016-08-05 16:36:31 194

原创 大数阶乘

输入一个数字,范围在1~10000之间,输出其的阶乘数。之前所做的都是小数的阶乘,用for足够,但是10000的阶乘早就报数据了。#includeusing namespace std;int main(){ int n,i,j,c,t; while(cin >> n) { int a[10000]; a[0] = 1; t = 0; //标记一个数字在被拆

2016-08-05 15:30:42 192

原创 杭电1272(并查集)判断环

上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她的设计图给你,让你帮忙判断她的

2016-08-04 15:30:28 517

原创 杭电1232(纯粹并查集)

某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?  Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出一对正整

2016-08-03 16:37:34 392

转载 拓展欧几里得(详细)

扩展欧几里德算法详解标签: 算法扩展c出版百度语言2012-07-25 21:49 15958人阅读 评论(9) 收藏 举报 分类:ACM_数学(3) 版权声明:本文为博主原创文章,未经博主允许不得转载。    扩展欧几里德算法    谁是欧几里德?自己百度去    先介绍什么叫做欧几里德算法    有

2016-08-03 15:10:32 252

原创 熄灯问题

一个由按钮组成的矩阵,其中每行有6个按钮,共5行。每个按钮的位置上有一盏灯。当按下一个按钮后,该按钮以及周围位置(上边、下边、左边、右边)的灯都会改变一次。即,如果灯原来是点亮的,就会被熄灭;如果灯原来是熄灭的,则会被点亮。在矩阵角上的按钮改变3盏灯的状态;在矩阵边上的按钮改变4盏灯的状态;其他的按钮改变5盏灯的状态。在上图中,左边矩阵中用X标记的按钮表示被按下,右边的矩阵表示灯状态的改变。对

2016-08-03 15:07:42 764

原创 杭电1033

For products that are wrapped in small packings it is necessary that the sheet of paper containing the directions for use is folded until its size becomes small enough. We assume that a sheet of paper

2016-08-02 14:52:43 262

转载 杭电1251(map)

#include #include #include #include using namespace std;int main(){ int i, len; char str[1000000]; map m; while( gets_s(str) ) { len = strlen(str); if (

2016-08-01 16:37:52 227

转载 杭电1251(关于字典树)

杭电1251————字典树基础讲解作者:Mlong54/*再次声明本文为转载原作者地址http://blog.csdn.net/u013548531/article/details/38896059*/题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251字典树又

2016-08-01 15:50:38 407

原创 杭电1057

Problem DescriptionA biologist experimenting with DNA modification of bacteria has found a way to make bacterial colonies sensitive to the surrounding population density. By changing the DNA

2016-07-31 10:14:26 211

原创 杭电1029

"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will be a special integer among them, you have to

2016-07-29 16:18:57 362

原创 约瑟夫问题(关于小猴)

约瑟夫问题:有n只猴子,按顺时针方向围成一圈选大王(编号从1到n),从第1号开始报数,一直数到m,数到m的猴子退出圈外,剩下的猴子再接着从1开始报数。就这样,直到圈内只剩下一只猴子时,这个猴子就是猴王,编程求输入n,m后,输出最后猴王的编号。Input 每行是用空格分开的两个整数,第一个是 n, 第二个是 m ( 0 Output 对于每行输入数据(最后一行除外),输出数据也是一行,即最后猴王

2016-07-28 15:30:04 269

原创 杭电1228

读入两个小于100的正整数A和B,计算A+B.需要注意的是:A和B的每一位数字由对应的英文单词给出. Input测试输入包含若干测试用例,每个测试用例占一行,格式为"A + B =",相邻两字符串有一个空格间隔.当A和B同时为0时输入结束,相应的结果不要输出.  Output对每个测试用例输出1行,即A+B的值. 

2016-07-26 17:40:30 278

原创 杭电1088

If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed. Now, who can forget to install a HTML browser? This is very easy because most of the ti

2016-07-25 15:48:22 417

原创 杭电1113

In millions of newspapers across the United States there is a word game called Jumble. The object of this game is to solve a riddle, but in order to find the letters that appear in the answer it is ne

2016-07-25 09:53:37 364

原创 各进制转换

通过数据库转换:#include   using namespace std;    int main()  {      int test=64;      cout"DEC:"    cout"OCT:"//八进制      cout"HEX:"//十六进制        return 0;  }运用递归运算: #include

2016-07-23 17:03:37 187

原创 skew数(关于进制)

在Skew binary表示中,第k位的值xk表示xk*(2^(k+1)-1)。每个位上的可能数字是0或1,最后面一个非零位可以是2,例如,          10120(skew)        =1*(2^5-1)+0*(2^4-1)+1*(2^3-1)+2*(2^2-1)+0*(2^1-1)        = 31+0+7+6+0=44。输入格式:输入包含一行或多行,每行包含

2016-07-23 15:44:31 340

原创 电梯问题

假设你要付给银行7枚硬币,那么你可以在第3号取款机上操作,先付给8枚硬币,接着在第0号取款机上操作,取回1枚硬币,最终你付给银行7枚硬币。注意:由于银行系统的保险措施,每台取款机最多只能被操作一次。现在,L先生将要向银行支取或交纳一定数额的硬币。你能设计出一个方案,对某些取款机进行操作,从面恰好完成L先生的要求。输入要求:输入由多行组成,每行表示要取款或付款的数目(正数表示取款,负数表

2016-07-23 15:12:47 578

原创 容器

set:采用insert()方法把元素插入集合中去,插入的具体规则在默认的比较规则下,是按元素值从小到大插入。int main(){ set s; s.insert(8); s.insert(1); s.insert(12); s.insert(6); s.insert(8); //第二次插入8,重复元素,不会插入 set::iterator it; for

2016-07-22 14:54:23 182

原创 键盘错误

打字时经常打错字,打成前面一个字符,所以请设计一个程序来表示你打错的字。样例输入:O S,GOMRYPSU/样例输出:IAM FINE TODAY。开始时if(p='W')cout<<‘Q“;可以直接定义一个字符串,把键盘对应的字符都按照顺序输入进去,保存。代码如下;#include #include using namespace std;string hk="`123

2016-07-21 14:54:56 563

原创 最长回文串

输入一个字符串,求出其中的最长回文字串,样例输入;Confucicss say:Madam,I‘m Asam。样例输出:Masam,I'm Asam。 这个题首先要判断最长那个回文串的位置,并且与大小写无关,用到函数(toupper);然后输出后面的字符串。#include #include #include #include using namespace std;#

2016-07-20 20:50:55 259

原创 素数判定(素数筛法)(欧拉)

这里主要说一下素数筛法,该方法可以快速的选取出1~N数字中的所有素数。时间复杂度远小于O(N*sqrt(N))方法为:从2开始,往后所有素数的倍数都不是素数。最后剩下的数都是素数。再说说欧拉公式,用来解决所有小于n中的数字有多少个与n互质,用Ψ(n)表示。Ψ(n)=n*(1-1/q1)*(1-1/q2)*……*(1-1/qk),n为和数,其中qi为n的质因数。Ψ(n)=n-1,n为

2016-07-20 15:35:59 5150

原创 杭电1004

Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will cou

2016-07-19 09:12:37 380

原创 杭电1013

The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two

2016-07-17 15:41:22 330

原创 拓展最小公倍数

The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.

2016-07-17 10:38:29 277

原创 string

#include #include using namespace std;int main(){/* string hk="i love mmm";   hk.append("ls");//最后面加上对应语句   hk.insert(7,"lss");//对应加上对应语句// string hk1 (hk,2);// string hk1=(9,"i"); 

2016-07-16 16:28:17 139

原创 最小公倍数(最大公约数)

Problem Description 求两个正整数的最小公倍数。 Input 输入数据含有不多于50对的数据,每对数据由两个正整数(0Output 对于每组数据n1和n1,计算最小公倍数,每个计算结果应占单独一行。在之前的解决方法是直接用循环写,现在老师说辗转相除法更明了,代码如下,#include using namespace std;int gys(in

2016-07-16 11:36:17 331

无纸化在线考试网

asp.net项目

2017-06-13

空空如也

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

TA关注的人

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