自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 大猪生小猪

Problem H:大猪生小猪Description很奇怪,最近养猪大户小刘事事顺心,事情如下:第一天,他有一只小猪(小母猪),到第二天,母猪就可以下一个小猪崽(当然还是小母猪).......以此类推,但是小刘也要挣钱,每只母猪下了两只小猪之后,小刘就决定把这头猪卖掉。假如有N天,小刘家有了多少头猪(按第一天家里有一头小母猪)。Input输入包含一个正整数T,代表有T组测试事例

2017-10-31 19:28:44 844

原创 HDU2048 神、上帝以及老天爷

Problem D: 神、上帝以及老天爷DescriptionHDU 2006'10 ACM contest的颁奖晚会隆重开始了! 为了活跃气氛,组织者举行了一个别开生面、奖品丰厚的抽奖活动,这个活动的具体要求是这样的: 首先,所有参加晚会的人员都将一张写有自己名字的字条放入抽奖箱中; 然后,待所有字条加入完毕,每人从箱中取一个字条; 最后,如果取得的字条上写的就是自己

2017-10-31 19:27:23 337

原创 HDU2045 LELE的RPG难题

杭电2045不容易系列之(3)—— LELE的RPG难题 人称“AC女之杀手”的超级偶像LELE最近忽然玩起了深沉,这可急坏了众多“Cole”(LELE的粉丝,即"可乐"),经过多方打探,某资深Cole终于知道了原因,原来,LELE最近研究起了著名的RPG难题:有排成一行的n个方格,用红(Red)、粉(Pink)、绿(Green)三色涂每个格子,每格涂一色,要求任何相邻的方格不

2017-10-31 19:25:10 249

原创 HDU2050 - 折线分割平面

折线分割平面----公式 f(n)=2n2 -n + 1  我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。Input输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=10000),表示

2017-10-31 19:16:30 279

原创 HDU2041 - 超级楼梯

H - 超级楼梯有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1Output对于每个测试实例,请输出不同走法的数量Sample Input223Sample Output12  #include

2017-10-31 19:12:35 353

原创 Critical Mass

Critical Mass题目大意:U代表危险物品铀,L代表安全物品铅,当U连续数目>=3时,为危险情况。输入数字N代表有四个箱子,每个箱子可以存放U或者L,求危险情况种数。 解题策略:网上有DP解的动态递推公式,还有一个策略是逆向考虑,通过解出安全的情况数,总情况数-安全情况数=危险情况数。                  总情况数为2^N种(组合排列),安全情况数满 足add

2017-10-31 19:09:06 277

原创 2乘n铺骨牌

在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出铺放方案的总数.例如n=3时,为2× 3方格,骨牌的铺放方案有三种,如下图: Input输入数据由多行组成,每行包含一个整数n,表示该测试实例的长方形方格的规格是2×n (0<n<=50)。Output对于每个测试实例,请输出铺放方案的总数,每个实例的输出占一行。 Sample In

2017-10-31 19:05:41 679

原创 Vector-Sort

Vector-SortYou are given integers.Sort the integers and print the sorted order.Store the integers in a vector.Vectors are sequence containers representing arrays that can change in size.· Declar

2017-10-31 19:04:26 452

原创 Vector-Erase

Vector-EraseYou are given a vector of integers.Then you are given queries.First query consists of integer denoting the position in the vector which should be removed.Next query consists of integers

2017-10-31 19:03:58 344

原创 Sets-STL

Sets-STLSets are a part of the C++ STL. Sets are containers that store unique elements following a specific order. Here are some of the frequently used member functions of sets:· Declaration:· s

2017-10-31 19:03:00 717

原创 Maximum Element——stack

Maximum ElementYou have an empty sequence, and you will be given queries. Each query is one of these three types:1 x  -Push the element x into the stack.2    -Delete the element present at the t

2017-10-30 08:47:36 418

原创 Maps-STL

Maps-STLMaps are a part of the C++ STL.Maps are associative containers that store elements formed by a combination of a key value and a mapped value, following a specific order.The mainly used membe

2017-10-30 08:46:26 479

原创 Lower Bound-STL

Lower Bound-STLYou are given integers in the sorted order. Then you are given queries. In each query you will be given an integer and you have to tell whether that integer is present in the array, i

2017-10-30 08:45:31 404

原创 Deque-STL

Deque-STLDouble ended queue or Deque(part of C++ STL) are sequence containers with dynamic sizes that can be expanded or contracted on both ends (either its front or its back). The member functions

2017-10-30 08:44:55 446

原创 poj 3233 Matrix Power Series

H - Matrix Power SeriesGiven a n × n matrix A and a positive integer k, find the sumS = A + A2 + A3 + … + Ak.InputThe input contains exactly one test case. The first line of input contains t

2017-10-30 08:42:01 231

原创 HDU 2157 How many ways

How many ways??Problem Description春天到了, HDU校园里开满了花, 姹紫嫣红, 非常美丽. 葱头是个爱花的人, 看着校花校草竞相开放, 漫步校园, 心情也变得舒畅. 为了多看看这迷人的校园, 葱头决定, 每次上课都走不同的路线去教室, 但是由于时间问题, 每次只能经过k个地方, 比方说, 这次葱头决定经过2个地方, 那他可以先去问鼎广场看看喷泉, 再去教

2017-10-30 08:37:13 263

原创 HDU 1575 - Tr A

C - Tr AA为一个方阵,则Tr A表示A的迹(就是主对角线上各项的和),现要求Tr(A^k)%9973。 Input数据的第一行是一个T,表示有T组数据。 每组数据的第一行有n(2 ,表示方阵A的内容。 Output对应每组数据,输出Tr(A^k)%9973。Sample Input22 21 00 13 999999991 2 3

2017-10-30 08:34:18 274

原创 HDU 1061 - Rightmost Digit

A - Rightmost DigitGiven a positive integer N, you should output the most right digit of N^N. InputThe input contains several test cases. The first line of the input is a single integer T which

2017-10-30 08:33:38 241

原创 HDU1097 - A hard puzzle

D - A hard puzzlelcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.

2017-10-30 08:33:06 350

原创 Codeforces 742A. Arpa’s hard exam and Mehrdad’s naive cheat

A. Arpa’s hard exam and Mehrdad’s naive cheattime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere exists an island called Arpa’s

2017-10-30 08:31:14 331

原创 UVA - 10382- Watering Grass

uva 10382 - Watering Grass(区域覆盖问题)  Sample Input8 20 25 34 11 27 210 213 316 219 43 10 13 59 36 13 10 15 31 19 1Sample Output62-1题目大意:有一块草坪,长为l,宽为w,在它

2017-10-29 09:16:14 279

原创 HDU 2124 Repair the Wall

F - Repair the WallLong time ago , Kitty lived in a small village. The air was fresh and the scenery was very beautiful. The only thing that troubled her is the typhoon.When the typhoon came,

2017-10-29 09:15:37 218

原创 HDU 2111 Saving HDU

E - Saving HDU话说上回讲到海东集团面临内外交困,公司的元老也只剩下XHD夫妇二人了。显然,作为多年拼搏的商人,XHD不会坐以待毙的。  一天,当他正在苦思冥想解困良策的时候,突然想到了自己的传家宝,那是公司成立的时候,父亲作为贺礼送来的一个锦囊,徐父当时交代,不到万不得已的时候,不要打开它。“现在不正是最需要的时候吗?”,一边想,XHD一边找到了这个精心保管的锦囊,打开一

2017-10-29 09:15:02 231

原创 HDU 2037 今年暑假不AC

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

2017-10-29 09:09:31 356

原创 HDU 1257 最少拦截系统

I - 最少拦截系统某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里来求救了,请帮助计

2017-10-29 09:08:27 218

原创 HDU 1051 wooden sticks

D - Wooden SticksThere is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs

2017-10-29 09:07:25 347

原创 HDU 1050 Moving Tables

C - Moving TablesThe 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 an

2017-10-29 08:57:11 427

原创 统计各位数字之和是5的数

统计各位数字之和是5的数:统计100~999之间有多少个其各位数字之和是5的整数,并计算这些数字的和。要求定义并调用函数is(number)判断number的各位数字之和是否等于5。

2017-10-28 11:29:40 17892

原创 下棋

C - PawnChessGalois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».This new game is played on a board consisting of 8

2017-10-28 11:28:26 287

原创 三家人

三家人有三户人家共拥有一座花园,每户人家的太太均需帮忙整理花园。A 太太工作了5 天,B太太则工作了4天,才将花园整理完毕。C太太因为正身怀六甲无法加入她们的行列,便出了90元。请问这笔钱如何分给A、B二位太太较为恰当?A应得多少元下面回答一个一般性的问题:假定A 太太工作了x 天,B太太工作了y天,C 太太出了90元,则A太太应得多少元

2017-10-28 11:26:38 317

原创 找规律

D - The Monster and the SquirrelAri the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her squirrel.Ari draws a regular convex polygon on

2017-10-28 11:25:44 238

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

#includeint main(){    int m,n,j,k;    do    {        printf("Input m:");        scanf("%d",&m);        printf("Input n:");        scanf("%d",&n);    }while(m    j=m;    while(

2017-10-28 11:25:06 265

原创 主要是打表---数豆子

打表可以简单理解为把需要算的结果先都算出来存进数组里多次需要调用结果就可以直接从表里找  Problem G: Count beans will be crazyTime Limit: 1 Sec Memory Limit: 128 MBDescriptionMother bought a basket of beans before winter came. Cl

2017-10-28 11:24:41 286

原创 编程题

编程题1、定义函数void revers(int a[],int n),实现将数组a中的前n个元素位置互换。仅写出函数定义即可。 void revers(int a[],int n){int b;int i,j;for(i=0,j=n-1;i{b=a[i];a[i]=a[j];a[j]=b;}} 2、定义函数void large(char

2017-10-28 11:23:52 2140

原创 cut(求和的)

时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述给你一个长度为n的序列,你每次可以将一个序列分割成两个连续的的子序列,分割的代价为原序列的总和。现在允许你在初始时将序列重新排列一次。问分割成n个长度为1的序列的最大总代价是多少?输入描述:第一行一个数n表示原序列的长

2017-10-28 11:22:26 298

原创 简单学生类

#include #include #include #include #include using namespace std;class student{public:    void setnum();//输入学生成绩    void sum();//学生个人成绩总和    void average();//学生个人平均成绩    int ge

2017-10-28 11:20:58 314

原创 简单日期类(文件)

#ifndef TDATE_H_INCLUDED#define TDATE_H_INCLUDED#include using namespace std;class Tdate{public:    void setdate(int m, int d, int y);    void isLeapYear();    void printf();privat

2017-10-28 11:19:49 375

原创 HDU 1049 Climbing Worm

B - Climbing WormAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it

2017-10-27 20:09:04 310

原创 HDU 1009 FatMouse' Trade

A - FatMouse' TradeFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room con

2017-10-27 20:08:12 600

原创 HDU - 2570 迷瘴

H - 迷瘴HDU - 2570  通过悬崖的yifenfei,又面临着幽谷的考验―― 幽谷周围瘴气弥漫,静的可怕,隐约可见地上堆满了骷髅。由于此处长年不见天日,导致空气中布满了毒素,一旦吸入体内,便会全身溃烂而死。幸好yifenfei早有防备,提前备好了解药材料(各种浓度的万能药水)。现在只需按照配置成不同比例的浓度。现已知yifenfei随身携带有n种浓

2017-10-27 20:07:01 302

空空如也

空空如也

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

TA关注的人

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