自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Number Sequence

Problem Description A number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n). Input The input co...

2018-04-02 15:36:26 288

原创 Max Sum

Problem Description 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 + ...

2018-04-02 10:02:23 171

原创 Let the Balloon Rise

Problem Description 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...

2018-03-29 16:27:37 224

原创 A + B Problem II

重新从简单的练手Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. Input The first line of the input contains an integer T(1<=T...

2018-03-29 15:35:37 149

原创 网页开发Myeclipse+MySQL流程

1、  数据库设计建立crud.student数据库表:图1 数据库表你可以使用如下语句创建该库表: [sql] view plaincopycreate database if not exists `crud`;  USE `crud`;  DROP TABLE IF EXISTS `student`;  CREATE TABLE `studen

2014-12-04 10:56:56 676

原创 拓扑排序 2892. Task

Peter is very interested in Artificial Intelligence. His teacher leaves him several problems. Since he is not very familiar with the subject, he will read some necessary information to complete the ta

2014-09-10 19:29:24 449 1

原创 4043. Magic Pen 6

In HIT, many people have a magic pen. Lilu0355 has a magic pen, darkgt has a magic pen, discover has a magic pen. Recently, Timer also got a magic pen from seniors.At the end of this term, teacher

2014-09-09 20:37:21 340

原创 1022. Packets

A factory produces products packed in square packets of the same height h and of the sizes 1x1, 2x2, 3x3, 4x4, 5x5, 6x6. These products are always delivered to customers in the square parcels of the s

2014-09-08 23:40:37 384

原创 1908. Automatic Editing

Text-processing tools like awk and sed allow you to automatically perform a sequence of editing operations based on a script. For this problem we consider the specific case in which we want to perform

2014-09-08 22:39:17 389

原创 2647. Printer Queue

The only printer in the computer science students' union is experiencing an extremely heavy workload. Sometimes there are a hundred jobs in the printer queue and you may have to wait for hours to ge

2014-09-08 21:53:29 456

原创 4003. I-number

The I-number of x is defined to be an integer y, which satisfied the the conditions below:1. y>x;2. the sum of each digit of y(under base 10) is the multiple of 10;3. among all integers that sat

2014-09-07 23:04:18 285

原创 3856. Rob

10 years ago, the students in Ant's primary school were often robbed by a bad guy on their way back home after school. Ant was so worried about this and he always tried to go back home as quickly as h

2014-09-07 11:44:20 323

原创 3823. Divisible Subsquences

题目大意:给定一个数和一个序列  计算这个序列中有多少个子序列的和是这个数的倍数。思路:a[i]+a[i+1]+..+a[j] = s[j]-s[i],如果要和是其倍数, 则表示s[j]-s[i]能够整除那个数,只要s[j]和s[i]对那个数的余数相同就可以了啊,所以,将各个和按余数分堆!! 每个堆选择两个出来,即(n*n-1)/2;ps: 余数分堆很常用!!  序列为两个相减也很常用!!

2014-09-07 10:19:39 371

原创 2547. Subsequence

终于知道错哪儿了。。。。刚开始用for循环,

2014-09-01 20:59:02 273

原创 1525. One Person "The Price is Right"

题目大意:每个人允许猜 G 次,有 L 生命线。猜低或猜高了,耗费一次猜得机会,猜高了,还             会浪费一生命线。   先从搜索考虑。设f(g,l)表示有g次机会,l条生命线时可以猜到的最大价格范围。      那么,f(g,l)应该由三段范围组成:猜低了,用剩下的机会还能猜出f(g-1,l)范围的价格;     猜得正好,可以猜出1个

2014-09-01 20:00:32 617

原创 1909. Robot Motion

A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions areN north (up the pag

2014-09-01 19:02:49 314

原创 2219. A famous math puzzle

¡题目描述:¡有n个壶,和无穷多的水.每次我们只能:¡1.把其中一个壶灌满.¡2.把其中一个壶倒空.¡3.把一个壶中的水倒入另一个壶中,直到一个壶为空或者另一个壶已经满了为止.¡给定一个体积W,问能否经过若干次倒水后使得最终有一个壶中只剩下W升水?如果能,输出”YES”,否则输出”NO”

2014-09-01 18:09:34 338

原创 1105. Word Index

Encoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with fi

2014-08-31 10:14:10 459

原创 2908. Annoying painting tool

水题题目 Maybe you wonder what an annoying painting tool is? First of all, the painting tool we speak of supports only black and white. Therefore, a picture consists of a rectangular area of pixel

2014-08-31 09:01:46 377

原创 dijstra算法 2870. The K-th City

这题的题意为求

2014-08-30 19:48:07 558

原创 DFS 2273. Making Change

Grocery stores have long struggled with how to avoid long checkout lines that leave customers frustrated. The ��10 item or less�� express line has been a common technique, but many stores a now trying

2014-08-30 10:38:26 1145

原创 BFS 1056. Labyrinth

总是出现Runtime Error(SIGSEGV)

2014-08-28 19:55:14 494

原创 BFS 1132. Knight Moves

在做这道题之前,居然不知道下棋是

2014-08-28 18:55:35 277

原创 BFS 3517. The longest athletic track

After a long time of algorithm training, we want to hold a running contest in our beautiful campus. Because all of us are curious about a coders's fierce athletic contest,so we would like a more longe

2014-08-28 17:42:16 413

原创 堆的实现 2196. Nuanran's Idol II

堆用数组实现,时间复杂度为O(logn),如果进一本书

2014-08-27 16:05:30 515

转载 scanf()如何读取一整行(转)

用scanf获取一行字符串包括空格的以及C语言函数其内容为#includeint main(){      char str[1024];      scanf("%[^\n]", &str);      ...      return 0;}说明:在scanf函数中, 可以使用%c来读取一个字符, 使用%s读取一个字符串, 但是读取字符

2014-08-26 19:40:15 1644 1

原创 3976. Change

After Shawn sees the following picture, he decides to give up his career in IT and turn to sell fruits. Since Shawn is a lazy guy, he doesn’t like to do any extra work. When he starts selling fruits,

2014-08-26 19:08:42 306

原创 4094. Spiral matrix

Given you a n*m matrix, you task is to output the corresponding Spiral matrix whose row is n and column is m.For example:1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9

2014-08-26 10:11:01 264

原创 ACM2014选拔 4076. Words Count

This task is very simply, give you an article, you should just output how many words there are.The words may be split by any separator such as ',' and '.' and so on.The words only contains letters

2014-08-26 09:14:07 374

原创 3259. Mysterious Number

Mysterious Number refers to a number which can be divisible by the number of distinct factors that it has. For instance, 1 (1 factor), 12 (6 factors) and 9 (3 factors) are Mysterious Numbers, but 7(2

2014-08-24 21:43:58 376

原创 BFS 2470. Robot in Maze

There is a robot trapped in the maze. Now you have to send out some instructions, telling it how to reach its destination.The maze is an M * N grid. Some of the cells are empty, while others are o

2014-08-24 19:59:20 508

原创 BFS 3071. Number Game

There is an interesting game. We start with a number K. Then three operations is allowed:1. Multiply current number by 22. Divide current number by 2, if current number is even.3. Increase curre

2014-08-24 15:49:34 355

原创 杭电 1005

递归切记:1.如果递归的次数

2014-08-23 16:08:12 483

原创 杭电 1004 Let the Balloon Rise

用  strcmp(char a,char b)比较字符串是否相等, 相等为0,头文件为#include<s

2014-08-23 12:31:53 292

原创 杭电1267 下沙的沙子有几粒?

题意:就是给你m个H和n个D,然后从左开始数H的累积个数总是不比D的累计数少的排列有多少种举一个测试案例吧:3个H和1个D总共有3种排列,依次是:H D H H,H H D H,H H  H D三种排列,亲~意思应该懂了吧?!呵呵。。。思路:递推公式为:a[m][n]=a[m-1][n]+a[m][n-1];然后当n=0的时候无论m取何值都是1,递推公式怎么推来的呢?我现在说下我的思路吧!

2014-08-23 10:15:41 374

原创 2894. Meetings

There are several meeting rooms in Tianjin University. Since there are a lot of new students registering at the beginning of the term, the directors of school have scheduled many meetings to discuss u

2014-08-22 20:19:10 534 1

原创 杭电 Moving Tables

Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure.The floor has 200 rooms each on the north side

2014-08-22 19:43:23 378

原创 杭电 Max Sum

Problem DescriptionGiven 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 +

2014-08-22 17:51:23 485

原创 杭电 Seinfeld

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1354    Accepted Submission(s): 665Problem DescriptionI’m out of stories. For years I’

2014-08-22 16:16:45 362

原创 杭电 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 i

2014-08-20 16:13:33 322

The Circumference of the Circle

#include <iostream> #include <math.h> #include<stdio.h> using namespace std; int main(){ const double pi = 3.141592653589793; double x1,y1,x2,y2,x3,y3,cosA; double a,b,c; while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF) { a = (double)sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1)); b = (double)sqrt((y3-y1)*(y3-y1)+(x3-x1)*(x3-x1)); c = (double)sqrt((y2-y3)*(y2-y3)+(x2-x3)*(x2-x3)); cosA = (b*b+c*c-a*a)/(2*b*c); printf("%.2f\n",pi*a/sqrt(1-cosA*cosA)); } return 0; }

2013-05-10

空空如也

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

TA关注的人

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