自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

树莓一只猪

我是一只有梦想的小猪

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

原创 河南省第十届蓝桥杯比赛感受

___谈起这场比赛,只能用“可惜可贺”来形容吧!可贺的是这次比赛拿了一个省赛二等奖,可惜的是差一步就能获得了参加国赛的资格了。___接下来谈谈这次比赛的整体感受:___赛前:______其实比赛前一个月,我已经安心准备考研了,几乎没有敲过代码了,也就天梯赛模拟赛敲过一下午代码,但是也就这次模拟赛,让我才能在接下来的比赛取得一个让他人感到可贺的成绩。比赛的头一天打完天梯赛模拟赛,就头晕目眩了,...

2019-04-04 15:07:12 377 1

原创 蓝桥--方格填数

题目如图,如下的10个格子,填入0~9的数字。要求:连续的两个数字不能相邻。(左右、上下、对角都算相邻)一共有多少种可能的填数方案?解题思路,先利用全排列方法,计算出每一种排列,然后再判断每一种排列是否符合题意要求...

2018-12-27 11:36:39 332

原创 java的全排列算法实现(next_permutation)

描述:给定一个整数数组,将这些数进行全排列。在C++中提供了next_permutation全排列方法,所谓next_permutation全排列即将按字母表顺序生成给定序列的下一个较大的序列,直到整个序列为减序为止。设当前序列为pn,下一个较大的序列为pn+1,那么不存在pm,使得pn < pm < pn+1;而在java中没有此方法,就自己手写了next_permutation的...

2018-12-27 09:49:25 4972 1

原创 131A- cAPS lOCK(正则表达式)

ProblemwHAT DO WE NEED cAPS LOCK FOR?Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to acc...

2018-12-25 16:37:24 306

原创 NowCoder--被打脸的潇洒哥

题目 链接:https://ac.nowcoder.com/acm/contest/318/M“画个圈圈诅咒你!”在一次青青草原ACM个人赛中,潇洒哥被喜洋洋以30s罚时压制,委屈的当了个第二。潇洒哥蹲在角落说出了他的口头禅,并画起了圈圈。突然,他想出了一个有趣的题目,跑去给喜洋洋做。喜洋洋看到题目后懵逼了,但是看到潇洒哥脸上欠揍的笑容就不爽,暗想一定要做出来狠狠的打潇洒哥的脸。于是,他以...

2018-12-23 18:37:39 234

原创 NowCoder--送气球

题目链接:https://ac.nowcoder.com/acm/contest/318/AACM-ICPC程序设计大赛是大学级别最高的脑力竞赛,素来被冠以"程序设计的奥林匹克"的尊称。大赛至今已有近40年的历史,是世界范围内历史最悠久、规模最大的程序设计竞赛。比赛形式是:从各大洲区域预赛出线的参赛队伍,于指定的时间、地点参加世界级的决赛,由1个教练、3个成员组成的小组应用一台计算机解决7到13...

2018-12-23 18:28:26 177

原创 Java中BigDecimal类及8种舍入模式

Java在java.math包中提供的API类BigDecimal,用于对超过16位有效位的数进行精确的运算。双精度浮点型变量double可以处理16位有效数。在应用中,需要对更大或者更小的数进行运算和处理。float和double只能用来做科学计算或工程计算,在商业计算中要用java.math.BigDecimal。BigDecimal所创建的是对象,我们不能使用传统的+、-、*、/等算术运算符...

2018-12-23 17:49:53 245

原创 NowCode--抢课了

题目链接:https://ac.nowcoder.com/acm/contest/321/B没有选上课的孩子,或者还有?”“救救孩子……”又又又到了选修课抢课的时间了!集训队成员全心备战亚洲区域赛,居然忘记了选课.缓过神来的集训队成员现在很想知道,每门课人数从小到大的排序结果是什么.Wty主席这时微微一笑,早已看穿了一切.他早就实时爬取了每一个学生所选的课程列表,现在只需要简单的统计...

2018-12-22 22:12:08 596

原创 用两个栈实现队列

题目描述:用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。思路:两个栈,有两个端口,那么肯定一个是用来入队的,另一个用来出队的。同时,由于栈是先进后出的,那么经过两次的入栈则会变为先进先出,即,第一次先进后出,第二次后进先出,两个加起来就变成了先进先出。算法实现public class TwoStacksQueue { public Stack&lt...

2018-12-17 20:34:39 97

原创 122A-- Lucky Division

题目Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky an...

2018-12-17 11:51:53 236

原创 NowCoder--Protoss and Zerg

题目链接:https://ac.nowcoder.com/acm/contest/303/H来源:牛客网1v1,是星际争霸(StarCraft)中最常见的竞技模式。tokitsukaze进行了n场1v1。在每一场的1v1中,她都有星灵(Protoss)和异虫(Zerg)两个种族可以选择,分别有a个单位和b个单位。因为tokitsukaze不太擅长玩人类(Terran),所以她肯定不会选择人...

2018-12-08 23:05:07 205

原创 NowCoder--Race Sorting

题目链接:https://ac.nowcoder.com/acm/contest/303/I来源:牛客网星际争霸(StarCraft)是暴雪公司制作发行的一款即时战略游戏。游戏描述了26世纪初期,位于银河系中心的三个种族在克普鲁星际空间中争夺霸权的故事。三个种族分别是:人类(Terran),异虫(Zerg),星灵(Protoss)。现在tokitsukaze拥有n个单位,每个单位的编号是1...

2018-12-08 21:29:56 157

原创 1088B--Ehab and subtraction

题目You’re given an array a. You should repeat the following operation k times: find the minimum non-zero element in the array, print it, and then subtract it from all the non-zero elements of the arra...

2018-12-05 22:22:39 204

原创 1082B--Vova and Trophies

题目Vova has won n trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row.The beauty of the arrangement is the length of the longest subsegment ...

2018-12-04 18:07:51 227

原创 1089A--Lazyland

题目The kingdom of Lazyland is the home to n idlers. These idlers are incredibly lazy and create many problems to their ruler, the mighty King of Lazyland.Today k important jobs for the kingdom (k≤n) ...

2018-12-03 09:13:46 1277

原创 1082A--Vasya and Book

题目Vasya is reading a e-book. The file of the book consists of n pages, numbered from 1 to n. The screen is currently displaying the contents of page x, and Vasya wants to read the page y. There are t...

2018-11-29 01:26:19 159

原创 1079C--Playing Piano

题目Little Paul wants to learn how to play piano. He already has a melody he wants to start with. For simplicity he represented this melody as a sequence a1,a2,…,an of key numbers: the more a number is...

2018-11-21 20:52:25 192

原创 1079B--Personalized Cup

题目At many competitions that have a word «cup» in its official name the winner is presented with an actual cup. This time the organizers of one unusual programming competition have decided to please t...

2018-11-20 19:21:50 364

原创 1079A--Kitchen Utensils

题目The king’s birthday dinner was attended by k guests. The dinner was quite a success: every person has eaten several dishes (though the number of dishes was the same for every person) and every dish...

2018-11-19 20:41:57 742

原创 45F-- Goats and Wolves

题目Once Vasya needed to transport m goats and m wolves from riverbank to the other as quickly as possible. The boat can hold n animals and Vasya, in addition, he is permitted to put less than n animal...

2018-11-18 17:48:13 298

原创 45D--Event Dates

题目On a history lesson the teacher asked Vasya to name the dates when n famous events took place. He doesn’t remembers the exact dates but he remembers a segment of days [li, ri] (inclusive) on which ...

2018-11-18 14:43:29 311

原创 45A--Codecraft III

题目Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly k months. He looked at the calendar and learned that at the mo...

2018-11-17 13:30:17 306

原创 26B--Regular Bracket Sequence

题目A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters «+» and «1» into this sequence. For example, sequences «(())()», «()» and «(()...

2018-11-12 21:13:40 523

原创 26A--Almost Prime

题目A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers wh...

2018-11-12 20:08:10 275

原创 959D--Mahmoud and Ehab and another array construction task

题目Mahmoud has an array a consisting of n integers. He asked Ehab to find another array b of the same length such that:b is lexicographically greater than or equal to a.bi ≥ 2.b is pairwise coprime...

2018-11-07 21:37:06 195

原创 959B—Mahmoud and Ehab and the message

题目Mahmoud wants to send a message to his friend Ehab. Their language consists of n words numbered from 1 to n. Some words have the same meaning so there are k groups of words such that all the words ...

2018-11-01 20:32:52 210

原创 959A--Mahmoud and Ehab and the even-odd game

题目Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer n and then they take turns, starting from Mahmoud. In each player’s turn, he has to choose an integer a and ...

2018-10-30 20:16:17 161

原创 961B--Lecture Sleep

题目Your friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so hard to st...

2018-10-29 21:36:40 290

原创 946A--Partition

题目You are given a sequence a consisting of n integers. You may partition this sequence into two sequences b and c in such a way that every element belongs exactly to one of these sequences.Let B be ...

2018-10-24 20:55:39 163

原创 1041A--Heist

题目There was an electronic store heist last night.All keyboards which were in the store yesterday were numbered in ascending order from some integer number x. For example, if x=4 and there were 3 key...

2018-10-23 19:29:20 277

原创 1065A Vasya and Chocolate

题目There is a special offer in Vasya’s favourite supermarket: if the customer buys a chocolate bars,he or she may take b additional bars for free.This special offer can be used any number of times.Va...

2018-10-22 20:36:37 173

原创 Uva--401 Palindromes

题目A regular palindrome is a string of numbers or letters that is the same forward as backward. Forexample, the string “ABCDEDCBA” is a palindrome because it is the same when the string is read fromle...

2018-10-17 20:53:42 142

原创 算法最优 设计一个有getMIn功能的栈

题目实现一个特殊的栈,在实现栈的基本功能的基础上,再实现返回栈中最小的元素的操作。要求1.pop,push,getMin操作时间复杂度都是O(1)。2.设计的栈类型可以使用现成的栈结构。思路在设计上,使用两个栈,一个栈保存当前栈中的元素,其功能和一个正常栈没有区别,记为stackData,另一个栈用于保存每一次比较的最小值,记为stackMin,具体方法有两种:一,压入数据规则假设...

2018-10-16 21:09:35 125

原创 CF--1A Theatre Square

Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city’s anniversary, a decision was taken to pave the Square with square granite...

2018-10-15 20:02:06 155

原创 NYOJ 236--心急的C小加

描述C小加有一些木棒,它们的长度和质量都已经知道,需要一个机器处理这些木棒,机器开启的时候需要耗费一个单位的时间,如果第i+1个木棒的重量和长度都大于等于第i个处理的木棒,那么将不会耗费时间,否则需要消耗一个单位的时间。因为急着去约会,C小加想在最短的时间内把木棒处理完,你能告诉他应该怎样做吗?输入第一行是一个整数T(1<T<1500),表示输入数据一共有T组。每组测试数据的第...

2018-10-08 23:24:42 92

原创 NYOJ586--疯牛

描述农夫 John 建造了一座很长的畜栏,它包括N (2 <= N <= 100,000)个隔间,这些小隔间依次编号为x1,…,xN (0 <= xi <= 1,000,000,000).但是,John的C (2 <= C <= N)头牛们并不喜欢这种布局,而且几头牛放在一个

2018-09-26 23:55:51 192 1

原创 NYOJ91--阶乘之和

描述给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3!,如果是,则输出Yes,否则输出No;输入第一行有一个整数0<m<100,表示有m组测试数据;每组测试数据有一个正整数n<1000000;输出如果符合条件,输出Yes,否则输出No;样例输入2910样例输出YesNoAC-Codeimp...

2018-09-25 20:09:30 187

原创 NYOJ106--背包问题

描述现在有很多物品(它们是可以分割的),我们知道它们每个物品的单位重量的价值v和重量w(1<=v,w<=10);如果给你一个背包它能容纳的重量为m(10<=m<=20),你所要做的就是把物品装到背包里,使背包里的物品的价值总和最大。输入第一行输入一个正整数n(1<=n<=5),表示有n组测试数据;随后有n测试数据,每组测试数据的第一行有两个正整数s,m(...

2018-09-19 20:47:39 125

原创 NYOJ824--Greedy Mouse

描述A fat mouse prepared M pounds of cat food,ready to trade with the cats guarding the warehouse containing hisfavorite food:peanut. The warehouse has N rooms.The ith room containsW[i] pounds of pean...

2018-09-17 21:13:41 152

原创 ACM-ICPC 2018 焦作赛区网络预赛--A. Magic Mirror

描述Jessie has a magic mirror.Every morning she will ask the mirror: ‘Mirror mirror tell me, who is the most beautiful girl in the world?’ If the mirror says her name, she will praise the mirror: ‘G...

2018-09-17 10:10:29 258

空空如也

空空如也

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

TA关注的人

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