自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

a_ppler的专栏

努力,明天会更好!

  • 博客(59)
  • 收藏
  • 关注

原创 火星文 wa

#include#include#includeint SS[100];int q=0;void ss(){ int k=0,f,i,j; for(i=2;i {  f=1;  k=(int)sqrt(i);  for(j=2;j  {   if(i%j==0)   {    f=0;    break;   }  }

2013-12-08 13:27:17 649

原创 HDU 1686 Oulipo

Problem DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pa

2013-11-23 11:38:05 624

原创 HDU 1051 Wooden Sticks (贪心,嵌套区间个数 )

Wooden Sticks Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 1   Accepted Submission(s) : 1Font: Times New Roman | Verdana | Georgia Font

2013-09-27 23:29:34 814

原创 HDU 1052 Tian Ji -- The Horse Racing

Problem DescriptionHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse racing with the king an

2013-09-25 21:51:21 538

原创 HDU 4731 Minimum palindrome 找规律 (2013 ACM/ICPC Asia Regional Chengdu Online 1004)

//比赛中自己少考虑一种情况,下面参考大牛的思路。上自己的代码。/* 题意,用前m个字母,组成长度为n的字符串,使得子串中回文数最小 当m=1时,必定全是a。 当m>2时,必定全是abc循环,因为要构成回文,回文中左右端点相同,且第二级相同。举例证明:a的右边必定是b,a的左边必定是c。所以含a的必定不能成回文。而不含a的只有bc,所以abc循环回文数最小。 当m=2时,思考用上述m>2

2013-09-16 23:14:53 548

原创 HDU 1050 Moving Tables (贪心,注意细节)

Moving TablesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15528    Accepted Submission(s): 5348Problem DescriptionThe famous ACM

2013-09-16 00:59:36 551

原创 HDU1009 FatMouse' Trade

FatMouse' TradeTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 34583    Accepted Submission(s): 11314Problem DescriptionFatMouse pre

2013-09-15 21:26:01 505

原创 HDU 1800 Flying to the Mars (贪心)

Flying to the MarsTime Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8651    Accepted Submission(s): 2823Problem DescriptionIn th

2013-09-10 19:48:31 553

原创 HDU 1257 最少拦截系统 (贪心---求最长递减序列(不连续的))

最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13559 Accepted Submission(s): 5414Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是

2013-09-09 17:58:21 568

原创 HDU 2037 今年暑假不AC (贪心---求最多不相交区间问题)

Problem Description“今年暑假不AC?”“是的。”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、超级

2013-09-07 21:49:44 872

转载 计算二进制中1的个数

问题描述任意给定一个32位无符号整数n,求n的二进制表示中1的个数,比如n = 5(0101)时,返回2,n = 15(1111)时,返回4这也是一道比较经典的题目了,相信不少人面试的时候可能遇到过这道题吧,下面介绍了几种方法来实现这道题,相信很多人可能见过下面的算法,但我相信很少有人见到本文中所有的算法。如果您上头上有更好的算法,或者本文没有提到的算法,请不要吝惜您的代码,分享的时候,也

2013-09-02 19:45:02 1110

原创 2013暑假江西联合训练赛(赛后) 二进制求和 (树状数组,这里需要变形下)

Problem Description平时我们经常会将一个数用二进制的形式来表示,我们用 BSUM(X) 表示X用二进制形式表示中1的个数。现在给你一个长度为n (n1 a b (12 a b (13 a b (1Input第一行输入T(每组测试先输入一行n,下一行输入n个数a[i](1然后输入q表示询问次数接下来q行代表每次询问。 Sample Input

2013-09-02 19:43:03 1417

原创 HDU 2492 Ping pong (树状数组+离散化+找规律)

Problem DescriptionN(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment).Each player has a unique skill rank. To improve their skill rank, they

2013-08-25 12:49:50 497

原创 HDU 2139 Calculate the formula公式 1^2+3^2+5^2+...+(2n-1)^2 ==n*(n+1)*(n+2)/6

Problem DescriptionYou just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.InputIn each case, there is an odd positive integer n.OutputPrint the sum. Make sure the su

2013-08-24 10:08:45 1001

原创 HDU 2136 Largest prime factor

Problem DescriptionEverybody knows any number can be combined by the prime number.Now, your task is telling me what position of the largest prime factor.The position of prime 2 is 1, prime 3 is

2013-08-24 09:35:04 511

原创 HDU 2133 What day is it(给定日期求星期几)

Problem DescriptionToday is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ?InputThere are multiply cases.One line is one case.There are three integ

2013-08-23 10:30:55 612

原创 HDU 1541 Stars (树状数组)

Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and

2013-08-22 17:32:47 500

原创 HDU 2642 Stars(二维树状数组)

Problem DescriptionYifenfei is a romantic guy and he likes to count the stars in the sky.To make the problem easier,we considerate the sky is a two-dimension plane.Sometimes the star will be brigh

2013-08-22 17:19:36 584

原创 HDU 1892 See you~(经典二维树状数组)

Problem DescriptionNow I am leaving hust acm. In the past two and half years, I learned so many knowledge about Algorithm and Programming, and I met so many good friends. I want to say sorry to Mr,

2013-08-22 17:09:23 629

原创 HDU 2114 Calculate S(n) (公式)

Problem DescriptionCalculate S(n).S(n)=13+23 +33 +......+n3 .InputEach line will contain one integer N(1 OutputFor each case, output the last four dights of S(N) in one line.

2013-08-22 09:01:50 839

原创 HDU 2689 Sort it(树状数组)(类似逆序数,同样不需要离散化)

Problem DescriptionYou want to processe a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. Then how many times it need.Fo

2013-08-21 13:43:03 788

原创 HDU 2688 Rotate(树状数组---求正序数)

Problem DescriptionRecently yifenfei face such a problem that give you millions of positive integers,tell how many pairs i and j that satisfy F[i] smaller than F[j] strictly when i is smaller than j

2013-08-21 13:27:03 854

原创 HDU 2050 直线相交问题(参考大牛总结)

(1) n条直线最多分平面问题      题目大致如:n条直线,最多可以把平面分为多少个区域。      析:可能你以前就见过这题目,这充其量是一道初中的思考题。但一个类型的题目还是从简单的入手,才容易发现规律。当有n-1条直线时,平面最多被分成了f(n-1)个区域。则第n条直线要是切成的区域数最多,就必须与每条直线相交且不能有同一交点。这样就会得到n-1个交点。这些交点将

2013-08-19 13:03:49 557

原创 错排公式理解和应用 HDU2048 2049 都是这种应用

当n个编号元素放在n个编号位置,元素编号与位置编号各不对应的方法数用M(n)表示,那么M(n-1)就表示n-1个编号元素放在n-1个编号位置,各不对应的方法数,其它类推.第一步,把第n个元素放在一个位置,比如位置k,一共有n-1种方法;第二步,放编号为k的元素,这时有两种情况⑴把它放到位置n,那么,对于剩下的n-1个元素,由于第k个元素放到了位置n,剩下n-2个元素就有M(n-2)种方法;

2013-08-19 12:59:06 597

原创 HDU 2057 A + B Again

Problem DescriptionThere must be many A + B problems in our HDOJ , now a new one is coming.Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal

2013-08-19 12:47:49 643

原创 HDU 2056 Rectangles (求两个相交矩形面积)

Problem DescriptionGiven two rectangles and the coordinates of two points on the diagonals of each rectangle,you have to calculate the area of the intersected part of two rectangles. its sides are p

2013-08-19 11:37:41 1633

转载 浮点数在计算机中存储方式

作者: jillzhang    联系方式:jillzhang@126.com    本文为原创,转载请保留出处以及作者, 谢谢    C语言和C#语言中,对于浮点类型的数据采用单精度类型(float)和双精度类型(double)来存储,float数据占用32bit, double数据占用64bit,我们在声明一个变量float f= 2.25f的时候,是如何分配内存的呢?

2013-08-18 10:37:45 572

原创 HDU 1985 Conversions 关于double 四舍五入 确定精度总结

我是在做HDU一直WA,AC后,无意发现的结论。下面请看:先上测试代码:#includeint main(){ double x; //x=0.5556; //x=0.5556001; x=0.5555; //x=0.5555001; printf("%.lf\n",x); printf("%.2lf\n",x); p

2013-08-18 10:07:32 716

原创 HDU 1877 又一版 A+B 及 itoa函数 应用 头文件 #include <stdlib.h>

char *itoa( int value, char *string,int radix);原型说明:value:欲转换的数据。string:目标字符串的地址。radix:转换后的进制数,可以是10进制、16进制等。编辑本段功 能把一个整数转换为字符串用 法itoa(i,num,10);i ----需要转换成字符串的数字

2013-08-17 10:06:32 1187

原创 HDU 1799 循环多少次?

我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如,如果代码中出现for(i=1;i那么做了n次OP运算,如果代码中出现fori=1;ifor(j=i+1;j那么做了n*(n-1)/2 次OP 操作。现在给你已知有m层for循环操作,且每次for中变量的起始值是上一个变量的起始值+1(第一个变量的起始值是1),终止值都是一个输入的n,问最后OP

2013-08-17 09:21:35 498

原创 HDU 1708 Fibonacci String

After little Jim learned Fibonacci Number in the class , he was very interest in it.Now he is thinking about a new thing -- Fibonacci String .He defines : str[n] = str[n-1] + str[n-2] ( n > 1 )

2013-08-16 11:17:23 400

原创 HDU 1418 抱歉(欧拉公式)

如果平面上有n个点,并且每个点至少有2条曲线段和它相连,就是说,每条曲线都是封闭的,同时,我们规定:1)所有的曲线段都不相交;2)但是任意两点之间可以有多条曲线段。如果我们知道这些线段把平面分割成了m份,你能知道一共有多少条曲线段吗?Input输入数据包含n和m,n=0,m=0表示输入的结束,不做处理。所有输入数据都在32位整数范围内。Outpu

2013-08-15 15:32:16 567

原创 HDU 1395 2^x mod n = 1

题目中给出输入一个整数n,要求一个最小整数的x,使得2^x mod n=1;根据模P乘法逆元:对于整数a、p如果存在整数b,满足a*b mod p=1则称b是a的模P乘法逆元。a存在模P的乘法逆元的充要条件是gcd(a,p)=1,令a=2^x,b=1,p=n则若存在x使用2^x mod n=1则gcd(2^x,n)=1(1)因为要求x的值大于0。则2^x的因子中只有

2013-08-15 10:37:14 983

原创 HDU 1335 Basically Speaking(进制转换问题)

The Really Neato Calculator Company, Inc. has recently hired your team to help design their Super Neato Model I calculator. As a computer scientist you suggested to the company that it would be neato

2013-08-15 08:58:00 522

原创 HDU 1194 Beat the Spread!

Problem DescriptionSuperbowl Sunday is nearly here. In order to pass the time waiting for the half-time commercials and wardrobe malfunctions, the local hackers have organized a betting pool on the

2013-08-13 14:46:50 743

原创 杭电1163--Eddy's digital Roots (九余数定理)

Problem DescriptionThe 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 result

2013-08-13 13:02:02 558

原创 HDU 1556 Color the ball 树状数组第二种:每次修改的是一个区间,所求的值是关于某个点的

Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。Sample Input31 12 23 33

2013-08-13 10:53:08 654

原创 树状数组小结及其注意事项

树状数组中用的d【】,每个点都有一定的管辖范围;如d[1]=a[1];d[2]=a[1]+a[2];d[3]=a[3];d[4]=a[1]+a[2]+a[3]+a[4];等等;这样的结构关键是为了,对一个数组内部动态的删除,增加,来高效的求某个点或者某个区间的值;比如说对数组a,改变某一位的值需O(1),求某个k区间值O(k);这样的

2013-08-13 10:44:59 488

原创 HDU 1166 敌兵布阵(数状数组)第一种:每次修改的是一个点,所求的是关于某段区间

Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视

2013-08-12 20:16:31 576

原创 strtok 函数功能及其应用 HDU 1106 排序

功能:strtok()用来将字符串分割成一个个片段。参数s指向欲分割的字符串,参数delim则为分割字符串中包含的所有字符。当strtok()在参数s的字符串中发现参数delim中包涵的分割字符时,则会将该字符改为\0 字符。在第一次调用时,strtok()必需给予参数s字符串,往后的调用则将参数s设置成NULL。每次调用成功则返回指向被分割出片段的指针。返回值:从s开头开始的一个个被

2013-08-12 12:46:35 555

空空如也

空空如也

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

TA关注的人

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