自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

小I的博客

尽管走下去,不必逗留着,去采鲜花来保存,因为在这一路上,花自然会继续开放。

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

原创 HDOJ 1005-Number Sequence【规律】

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).

2016-03-31 21:02:43 466

原创 HDOJ 2053-Switch Game

There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the condition ( on to off and off to on ).

2016-03-31 20:35:55 283

原创 ♥HDOJ 2050-折线分割平面【几何图形+公式推理】

我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。

2016-03-31 20:19:24 437

原创 HDOJ 2047-阿牛的EOF牛肉串【规律】

今年的ACM暑期集训队一共有18人,分为6支队伍。其中有一个叫做EOF的队伍,由04级的阿牛、XC以及05级的COY组成。在共同的集训生活中,大家建立了深厚的友谊,阿牛准备做点什么来纪念这段激情燃烧的岁月,想了一想,阿牛从家里拿来了一块上等的牛肉干,准备在上面刻下一个长度为n的只由"E" "O" "F"三种字符组成的字符串(可以只有其中一种或两种字符,但绝对不能有其他字符),阿牛同时禁止在串中出现O相邻的情况,他认为,"OO"看起来就像发怒的眼睛,效果不好。你,NEW ACMer,EOF的崇拜者,能帮阿

2016-03-31 20:04:07 379

原创 CodeForces 366C-Dima and Salad【01背包】

Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something.Dima and Seryozha have n fruits in the fridge. Each fruit has two parameters: the tast

2016-03-31 18:31:49 376

原创 CodeForces 368B-Sereja and Suffixes【模拟】

Sereja has an array a, consisting of n integers a1, a2, ..., an. The boy cannot sit and do nothing, he decided to study an array. Sereja took a piece of paper and wrote out m integers l1, l2, ..., lm (1 ≤ li ≤ n). For each number li he wants to know how ma

2016-03-31 17:37:58 455

原创 CodeForces 368A-Sereja and Coat Rack【队列】

Sereja owns a restaurant for n people. The restaurant hall has a coat rack with n hooks. Each restaurant visitor can use a hook to hang his clothes on it. Using the i-th hook costs ai rubles. Only one person can hang clothes on one hook.Tonight Sereja ex

2016-03-31 13:41:57 470

原创 CodeForces - 366B Dima and To-do List

You helped Dima to have a great weekend, but it's time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong.Inna and Dima are now in one room. Inna tells Dima off for everything he does in her presence. After Inna tells

2016-03-30 22:07:48 607

原创 CodeForces 366A- Dima and Guards

Nothing has changed since the last round. Dima and Inna still love each other and want to be together. They've made a deal with Seryozha and now they need to make a deal with the dorm guards...There are four guardposts in Dima's dorm. Each post contains

2016-03-30 21:19:54 274

原创 HDOJ 1116-Play on Words【欧拉路径+欧拉回路+并查集】

Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is very important for us. There is a large number of magnetic plat

2016-03-28 21:35:20 556

原创 HDOJ 5651-xiaoxin juju needs help【字符的全排列】

As we all known, xiaoxin is a brilliant coder. He knew **palindromic** strings when he was only a six grade student at elementry school.This summer he was working at Tencent as an intern. One day his leader came to ask xiaoxin for help. His leader gave h

2016-03-28 20:32:22 462

原创 HDOJ 5650-so easy

Given an array with n integers, assume f(S)f(S) as the result of executing xor operation among all the elements of set SS. e.g. if S = {1,2,3}S={1,2,3} then f(S) = 0f(S)=0.your task is: calculate xor of all f(s)f(s), here s \subseteq Ss⊆S.

2016-03-28 19:45:46 347

原创 浙江科技学院第十三届程序设计竞赛 1008-A Heavy Rainy Day【贪心思维】

As you know, Hangzhou always rains heavily, especially in Xiaoheshan area, which does annoy ACMers for a longer time. One day, N hardworking ACMers were playing League of Legends in the lab, of course not include me, while it was raining cats and dogs. Eve

2016-03-28 19:40:56 753

原创 浙江科技学院第十三届程序设计竞赛 1007-幸福指数

为了庆祝集训队队员在省赛上的出色表现,林老大给小盆友们买了个蛋糕作为奖励,蛋糕可以看成是一个n*n的正方形,上面随机摆放了一些糖果。看到糖果,集训队的小朋友都非常幸福,然而这个幸福指数是可以计算的。每当集训队的小盆友找到一对糖果在同一列或者同一行中,他们的幸福指数就会加1。现在给出蛋糕的描述,求小盆友们的幸福指数。

2016-03-28 19:38:09 744

原创 浙江科技学院第十三届程序设计竞赛 1006-田忌赛马后传

田忌赛马相信大家都很熟悉了。。。齐王在吃过亏后洗心革面,努力钻研ACM,终于成为算法大神。他决定再次向田忌挑战,但同时他又很欣赏田忌,让他有赢的机会,于是改变了下规则:齐王和田忌各拥有n匹马,每匹马有一个速度值,快的马总是能战胜慢的马,当两匹马速度相同时为平局,现在,齐王规定每赢一场(即双方各挑出一只马决斗,用过的马不可再用)可以获得100金币,齐王要求田忌能过获得最多的金币。田忌听到后吓的不行,TMD我只会3只马的情况,多了我脑子不够用,于是求助也是算法大神的你,你能帮他解决吗?

2016-03-28 19:35:18 970

原创 HDOJ 5645-DZY Loves Balls【模拟】

DZY loves playing balls.He has n balls in a big box. On each ball there is an integer written.One day he decides to pick two balls from the box. First he randomly picks a ball from the box, and names it A. Next, without putting A back into the box, he

2016-03-19 21:18:35 573

原创 UESTC 1012-Ladygod【没有负数】

LadygodEditTime Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)SubmitStatus10Input第一行读入一个整数 T(1≤T≤100000)T(1≤T≤100000) 表示数据组数接下来有TT行每行含两个数A,BA,B (不超过4...

2016-03-19 21:13:35 433

原创 NBUT [1647] 又一道简单题【暴力】

[1647] 又一道简单题 时间限制: 5000 ms 内存限制: 65535 K 问题描述 输入一个四个数字组成的整数 n,你的任务是数一数有多少种方法,恰好修改一个数字,把它 变成一个完全平方数(不能把首位修改成 0)。比如 n=7844,有两种方法:3844=62^2和 7744=88^2。   输入 输入第一行为整数 T (1<=T<=1000),...

2016-03-19 21:10:17 793

原创 ❤BZOJ 2705: [SDOI2012]Longge的问题

2705: [SDOI2012]Longge的问题Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 2007  Solved: 1247[Submit][Status][Discuss]DescriptionLongge的数学成绩非常好,并且他非常乐于挑战高难度的数学问题。现在问题来了:给定一个整数N,你需要求出∑gcd(i, N)(1&...

2016-03-19 14:07:36 284

原创 ♥BZOJ 2190: [SDOI2008]仪仗队【欧拉函数】

2190: [SDOI2008]仪仗队Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 2298  Solved: 1438[Submit][Status][Discuss]Description  作为体育委员,C君负责这次运动会仪仗队的训练。仪仗队是由学生组成的N * N的方阵,为了保证队伍在行进中整齐划一,C君会跟在仪仗队的左后方...

2016-03-18 18:23:39 283

原创 欧拉函数

对正整数n,欧拉函数是少于或等于n的数中与n互质的数的数目。例如euler(8)=4,因为1,3,5,7均和8互质。 Euler函数表达通式:euler(x)=x(1-1/p1)(1-1/p2)(1-1/p3)(1-1/p4)…(1-1/pn),其中p1,p2……pn为x的所有素因数,x是不为0的整数。euler(1)=1(唯一和1互质的数就是1本身)。 欧拉公式的延伸:一个数的所有质因子之和是euler(n)*n/2。 那么如何变成实现欧拉函数呢?下面通过两种不同的方法来实

2016-03-18 17:56:46 308

原创 BZOJ 2456: mode【妙脆角】

2456: modeTime Limit: 1 Sec  Memory Limit: 1 MBSubmit: 2790  Solved: 1178[Submit][Status][Discuss]Description给你一个n个数的数列,其中某个数出现了超过n div 2次即众数,请你找出那个数。Input第1行一个正整数n。第2行n个正整数用空格隔开。Output...

2016-03-18 16:45:05 938

原创 BZOJ 2463: [中山市选2009]谁能赢呢?

2463: [中山市选2009]谁能赢呢?Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1407  Solved: 1030[Submit][Status][Discuss]Description小明和小红经常玩一个博弈游戏。给定一个n×n的棋盘,一个石头被放在棋盘的左上角。他们轮流移动石头。每一回合,选手只能把石头向上,下,左,右...

2016-03-18 16:21:43 295

原创 BZOJ 1041: [HAOI2008]圆上的整点

1041: [HAOI2008]圆上的整点Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2951  Solved: 1296[Submit][Status][Discuss]Description求一个给定的圆(x^2+y^2=r^2),在圆周上有多少个点的坐标是整数。InputrOutput整点个数Sample...

2016-03-18 15:59:16 473

原创 第五届蓝桥杯大赛个人赛(软件类)省赛真题C本科B

标题:啤酒和饮料    啤酒每罐2.3元,饮料每罐1.9元。小明买了若干啤酒和饮料,一共花了82.3元。    我们还知道他买的啤酒比饮料的数量少,请你计算他买了几罐啤酒。    注意:答案是一个整数。请通过浏览器提交答案。    不要书写任何多余的内容(例如:写了饮料的数量,添加说明文字等)。answer:11标题:切面条

2016-03-17 20:43:27 796

原创 蓝桥杯 PREV-27 蚂蚁感冒【模拟】

长100厘米的细长直杆子上有n只蚂蚁。它们的头有的朝左,有的朝右。  每只蚂蚁都只能沿着杆子向前爬,速度是1厘米/秒。  当两只蚂蚁碰面时,它们会同时掉头往相反的方向爬行。  这些蚂蚁中,有1只蚂蚁感冒了。并且在和其它蚂蚁碰面时,会把感冒传染给碰到的蚂蚁。  请你计算,当所有蚂蚁都爬离杆子时,有多少只蚂蚁患上了感冒。

2016-03-17 20:18:23 356

原创 NYOJ 353-3D dungeon

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and

2016-03-17 18:13:12 644

原创 蓝桥杯 PREV-28 地宫取宝【DFS】

X 国王有一个地宫宝库。是 n x m 个格子的矩阵。每个格子放一件宝贝。每个宝贝贴着价值标签。  地宫的入口在左上角,出口在右下角。  小明被带到地宫的入口,国王要求他只能向右或向下行走。  走过某个格子时,如果那个格子中的宝贝价值比小明手中任意宝贝价值都大,小明就可以拿起它(当然,也可以不拿)。  当小明走到出口时,如果他手中的宝贝恰好是k件,则这些宝贝就可以送给小明。  请你帮小明算一算,在给定的局面下,他有多少种不同的行动方案能获得这k件宝贝。

2016-03-17 12:41:41 343

原创 栈和队列基本函数

使用标准库的栈和队列时,先包含相关的头文件#include<stack>#include<queue>定义栈如下:stack<int> stk;定义队列如下:queue<int> q;栈提供了如下的操作

2016-03-16 22:03:02 5804

原创 蓝桥杯 历届试题 小朋友排队

n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。  每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。  如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他交换,则他的不高兴程度增加2(即不高兴程度为3),依次类推。当要求某个小朋友第k次交换时,他的不高兴程度增加k。  请问,要让所有小朋友按从低到高排队,他们的不高兴程度之和最小是多少。  如果有两个小朋友身高一样,则他们谁站在谁前面是没有关系的

2016-03-16 21:26:33 566

原创 CodeForces 526A-King of Thieves

Let's call a level to be good if you can perform a sequence of four jumps of the same length or in the other words there must be a sequence i1, i2, ..., i5, consisting of five platforms so that the intervals between consecutive platforms are of the same le

2016-03-15 20:59:24 464

原创 HDOJ 2159-FATE【完全背包】

最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗?

2016-03-15 20:31:30 469

原创 HDOJ 2160-母猪的故事【队列】

话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生活。说来也奇怪,他养的猪一出生第二天开始就能每天中午生一只小猪,而且生下来的竟然都是母猪。不过光生小猪也不行,0068采用了一个很奇特的办法来管理他的养猪场:对于每头刚出生的小猪,在他生下第二头小猪后立马被杀掉,卖到超市里。假设在创业的第一天,0068只买了一头刚出生的小猪,请问,在第N天晚上,0068的养猪场里还存有多少头猪?

2016-03-15 20:01:49 659

原创 CodeForces 526A-Voting for Photos【模拟】

After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to choose a winner: the photo which g

2016-03-15 19:31:12 611

原创 CodeForces 367A-Sereja and Algorithm【规律】

Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let's represent the input string of the algorithm as q = q1q2... qk. The algorithm consists of two steps:Find any continuous subsequen

2016-03-15 17:43:42 313

原创 ♥codeforces 627A-XOR Equation【数学】

Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?

2016-03-15 16:28:41 1014

原创 HDOJ 2190-悼念512汶川大地震遇难同胞——重建希望小学【最恨递归】

为什么会有这么多的学校伤亡惨重?也许有很多值得我们调查的东西。但对于我们来说,当前最紧迫的任务是重建学校,以便让幸存的学生早日走进课堂。这不,一所由社会各界捐款修建的希望小学马上就要竣工了!学校教室的长度为n米,宽度为3米,现在我们有2种地砖,规格分别是1米×1米,2米×2米,如果要为该教室铺设地砖,请问有几种铺设方式呢?

2016-03-14 20:50:38 556

原创 CodeForces 597A-Divisibility【数学】

Find the number of k-divisible numbers on the segment [a, b]. In other words you need to find the number of such integer values x that a ≤ x ≤ b and x is divisible by k.

2016-03-14 18:55:51 504

原创 CodeForces 618A-Slime Combining【模拟】

Your friend recently gave you some slimes for your birthday. You have n slimes all initially with value 1.You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the othern - 1 slimes one by

2016-03-14 18:32:42 330

原创 CodeForces 622A-Infinite Sequence

Consider the infinite sequence of integers: 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, 1, 2, 3, 4, 5.... The sequence is built in the following way: at first the number 1 is written out, then the numbers from 1 to 2, then the numbers from 1 to 3, then the numbers from

2016-03-14 18:03:57 323

空空如也

空空如也

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

TA关注的人

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