自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 大写的H

You are given a sequence [Math Processing Error]a1,a2,…,an consisting of [Math Processing Error]n integers.You may perform the following operation on this sequence: choose any element and either increase or decrease it by one.Calculate the minimum possib

2020-06-06 21:09:42 543

原创 K - Goldbach`s Conjecture

Goldbach’s conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:Every even integer, greater than 2, can be expressed as the sum of two primes [1].Now your task is to check whether this conjecture holds f

2020-06-05 18:03:22 149

原创 All in All

You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted in

2020-06-04 21:03:59 295

原创 拓扑

John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task isonly possible if other tasks have already been executed.InputThe input will consist of several instances of the problem. Each instance begins with a lin

2020-06-03 18:30:13 291

原创 畅通工程再续

相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小岛之间有路通即可。其中桥的价格为 100元/米。Input输入包括多组数据。输入首先包括一个整数T(T &l

2020-05-30 19:00:19 316

原创 Leading and Trailing

You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.InputInput starts with an integer T (≤ 1000), denoting the number of test cases.Each case starts with a line containing

2020-05-29 20:30:26 222

原创 The number of divisors(约数) about Humble Numbers

A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, … shows the first 20 humble numbers.Now given a humble number, please write a program to calcul

2020-05-28 20:37:55 95

原创 pearls

In Pearlania everybody is fond of pearls. One company, called The Royal Pearl, produces a lot of jewelry with pearls in it. The Royal Pearl has its name because it delivers to the royal family of Pearlania. But it also produces bracelets and necklaces for

2020-05-27 15:23:48 194

原创 A/B

要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input21000 5387 123456789Sample Output79226060x=y*9973+n代码如下

2020-05-26 20:00:56 1062

原创 F - 6

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of security to change such things every now and then, to keep

2020-05-23 20:49:46 347

原创 母牛保龄球

The cows don’t use actual bowling balls when they go bowling. They each take a number (in the range 0…99), though, and line up in a standard bowling-pin-like triangle like this: 7 3 8 8 1 02 7 4 44 5 2 6 5Then t

2020-05-21 22:08:30 173

原创 马走日

BackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one direction and one square perpendicular to this. The worl

2020-05-21 18:08:39 187 1

原创 Heavy Transortation

BackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his customer has build his giant steel crane to the place where

2020-05-20 22:45:58 100

原创 抓牛

Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes o

2020-05-19 21:04:59 384

原创 A - Equations

Consider equations having the following form:ax12+b*x22+cx32+d*x42=0a, b, c, d are integers from the interval [-50,50] and any of them cannot be 0.It is consider a solution a system ( x1,x2,x3,x4 ) that verifies the equation, xi is an integer from [-100

2020-05-16 19:11:33 248

原创 扑克

Adam and Eve play a card game using a regular deck of 52 cards. The rules are simple. The players sit on opposite sides of a table, facing each other. Each player gets k cards from the deck and, after looking at them, places the cards face down in a row on

2020-05-15 18:35:28 201

原创 变形的并查集

某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<M<1000),分别代表现有城镇的数目和已修建的道路的数目。城镇分别以0~N-1编号。接下来是M行道路信息。每

2020-05-14 20:31:47 138

原创 搜索

Ignatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个ABC的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ignatius能否在魔王回来前离开城堡(只要走到出口就算离开城堡,如果走到出口的时候魔王刚好回来也算逃亡成功),如果可

2020-05-13 19:38:04 1408

原创 B - Sum of Round Numbers

A positive (strictly greater than zero) integer is called round if it is of the form d00…0. In other words, a positive integer is round if all its digits except the leftmost (most significant) are equal to zero. In particular, all numbers from 11 to 99 (in

2020-05-12 21:25:09 283

原创 博弈

任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;F(n)=F(n-1)+F(n-2)(n>=3);所以,1,2,3,5,8,13……就是菲波那契数列。在HDOJ上有不少相关的题目,比如1005 Fibonacci again就是曾经的浙江省赛题。今天,又一个关于Fibonacci的题目出现了,它是一个小游戏,定义如下:1、 这是一个二人游戏;2、 一共有3堆石子,数量分别是m, n, p个;3、 两人

2020-05-08 18:57:03 157

原创 The Perfect Stall

Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the new barn are different. For the fi...

2020-05-07 21:33:46 188

转载 过山车

RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了。可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找个个男生做partner和她同坐。但是,每个女孩都有各自的想法,举个例子把,Rabbit只愿意和XHD或PQK做partner,Grass只愿意和linle或LL做partner,PrincessSnow愿意和水域浪子或伪酷儿做partner。考虑...

2020-05-04 19:06:38 475

原创 展开字符串

在纺织CAD系统开发过程中,经常会遇到纱线排列的问题。该问题的描述是这样的:常用纱线的品种一般不会超过25种,所以分别可以用小写字母表示不同的纱线,例如:abc表示三根纱线的排列;重复可以用数字和括号表示,例如:2(abc)表示abcabc;1(a)=1a表示a;2ab表示aab;如果括号前面没有表示重复的数字出现,则就可认为是1被省略了,如:cd(abc)=cd1(abc)=cdabc;这种表...

2020-04-30 18:32:49 168

原创 皇后

在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input18...

2020-04-29 18:28:37 397

原创 Tree Recovery

Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes.This is an example of one of her creatio...

2020-04-28 22:11:09 211

原创 后序

A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtrees. There are three most important ways in which th...

2020-04-25 18:53:06 314

原创 E - Wireless Network

An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the n...

2020-04-24 19:18:12 215

原创 哈夫

Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer length Li (1 ≤ Li ...

2020-04-23 17:46:29 209

原创 求先序

给出一棵二叉树的中序与后序排列。求出它的先序排列。(约定树结点用不同的大写字母表示,长度 \le≤ 88)。输入格式22 行,均为大写字母组成的字符串,表示一棵二叉树的中序与后序排列。输出格式11 行,表示一棵二叉树的先序。输出时每行末尾的多余空格,不影响答案正确性样例输入BADCBDCA样例输出ABCD二叉树的遍历有三种常用方式,分别为先序遍历(根节点->左子树-&g...

2020-04-22 18:31:20 776 1

原创 二叉树基础

哈夫曼树priority_queue<int,vector<int>,greater<int> >Q; Q.push(x); int ans=0; while(Q.size()>=2) { int p=Q.top(); Q.pop(); int q=Q.top(); ...

2020-04-21 18:17:32 119

原创 Max Sum

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 + 4 = 14.InputThe first l...

2020-04-18 18:46:40 74

原创 队列广搜

A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find theshortest closed tour of knight moves that visits each square of a given set of n squares on a chessboa...

2020-04-17 17:57:52 195

原创 变形的01背包

电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Input多组数据。对于每组数据:第一行为正整数n,表示菜的...

2020-04-16 18:22:50 232

原创 01背包一维数组

贝茜去了购物中心的珠宝店,探寻一条魅力手链。 当然,她想用N个(1≤N≤3,402)可用的饰物填充尽可能的最佳饰物。 提供的列表中的每个超级字符i的权重均为Wi(1≤Wi≤400),“合意性”因子Di(1≤Di≤100),最多可以使用一次。 贝西只能支撑重量不超过M(1≤M≤12,880)的手链。给定重量限制作为约束,并列出具有其重量和合意性等级的护身符清单,就可以得出最大可能的等级总和。输入...

2020-04-15 16:41:44 431

原创 01背包二维数组

假设一个小偷偷珠宝店,拿了一个承重20的背包,求能偷得最大价值重 价2 33 44 55 89 1最大价值 23https://www.bilibili.com/video/av36136952?from=search&seid=11644509251735546077是这个视频里面人讲的例题,挺好理解的,可以去看看。#inclu...

2020-04-14 22:10:14 123

原创 prime time

Euler is a well-known matematician, and, among many other things, he discovered that the formulan2 + n + 41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681, which is 41 ∗ 41...

2020-04-11 13:07:31 394

原创

给你一串字符,不超过50个字符,可能包括括号、数字、字母、标点符号、空格,你的任务是检查这一串字符中的( ) ,[ ],{ }是否匹配。Input输入数据有多组,每组数据不超过100个字符并含有( ,) ,[, ],{, }一个或多个。处理到文件结束。Output如果匹配就输出“yes”,不匹配输出“no”Sample Inputsin(20+10){[}]Sample Out...

2020-04-10 21:15:40 144

原创 Dijkstra

在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛场所在地...

2020-04-09 19:47:14 132

原创 彼岸

突破蝙蝠的包围,yifenfei来到一处悬崖面前,悬崖彼岸就是前进的方向,好在现在的yifenfei已经学过御剑术,可御剑轻松飞过悬崖。现在的问题是:悬崖中间飞着很多红,黄,蓝三种颜色的珠子,假设我们把悬崖看成一条长度为n的线段,线段上的每一单位长度空间都可能飞过红,黄,蓝三种珠子,而yifenfei必定会在该空间上碰到一种颜色的珠子。如果在连续3段单位空间碰到的珠子颜色都不一样,则yifenf...

2020-04-08 18:41:54 83

原创 确定比赛名次

有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。Input输入有若干组,每组中的第一行为二个数N(1<=N<=500),M;其中N表示队伍...

2020-04-07 12:47:07 403

空空如也

空空如也

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

TA关注的人

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