- 博客(60)
- 收藏
- 关注
原创 B - Graph Without Long Directed Paths
原题链接:http://codeforces.com/problemset/problem/1144/FYou are given a connected undirected graph consisting ofnnvertices andmmedges. There are no self-loops or multiple edges in the given graph....
2019-07-17 21:32:05 231
原创 A - Cover it!
原题链接:http://codeforces.com/problemset/problem/1176/EYou are given an undirected unweighted connected graph consisting ofnnvertices andmmedges. It is guaranteed that there are no self-loops or mu...
2019-07-17 21:14:25 299
转载 Taotao Picks Apples
Problem DescriptionThere is an apple tree in front of Taotao's house. When autumn comes,napples on the tree ripen, and Taotao will go to pick these apples.When Taotao picks apples, Taotao scans t...
2019-07-17 20:51:06 347
原创 小阳的贝壳
链接:https://ac.nowcoder.com/acm/contest/949/H来源:牛客网题目描述小阳手中一共有 n 个贝壳,每个贝壳都有颜色,且初始第 i 个贝壳的颜色为 colicoli 。现在小阳有 3 种操作:1 l r x:给 [l,r][l,r] 区间里所有贝壳的颜色值加上 xx 。2 l r:询问 [l,r][l,r] 区间里所有相邻贝壳 颜色值的差(取绝...
2019-07-17 20:45:48 239
原创 E. XOR and Favorite Number
Bob has a favorite numberkandaiof lengthn. Now he asks you to answermqueries. Each query is given by a pairliandriand asks you to count the number of pairs of integersiandj, such thatl ...
2019-06-25 21:52:56 346
原创 D. Berland Fair
题目链接:http://codeforces.com/contest/1073/problem/DXXI Berland Annual Fair is coming really soon! Traditionally fair consists ofnnbooths, arranged in a circle. The booths are numbered11throughnnc...
2019-06-23 13:11:54 261
原创 comt oj Comet OJ - Contest #5
迫真小游戏题目链接:https://cometoj.com/contest/46/problem/C?problem_id=2028题目描述H君喜欢在阳台晒太阳,闲暇之余他会玩一些塔防小游戏。H君玩的小游戏可以抽象成一棵nn个节点的有根树,树以11为根,每个点的深度定义为其到根的简单路径上的点数(根的深度为11)。H君有nn个干员,H君会按照某种顺序把她们部...
2019-06-23 12:57:52 379
原创 E. Lunar New Year and Red Envelopes
题目链接:http://codeforces.com/problemset/problem/1106/ELunar New Year is approaching, and Bob is going to receive some red envelopes with countless money!But collecting money from red envelopes is a t...
2019-06-21 16:06:11 465
原创 B. Nauuo and Circle
题目链接:http://codeforces.com/problemset/problem/1172/BNauuo is a girl who loves drawing circles.One day she has drawn a circle and wanted to draw a tree on it.The tree is a connected undirected gr...
2019-06-17 21:57:04 439
原创 A. Primes or Palindromes?
题目链接:http://codeforces.com/problemset/problem/568/ARikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex and unpredictable. A palindromic number...
2019-06-15 22:01:55 208
原创 A. Mafia
One daynfriends gathered together to play "Mafia". During each round of the game some player must be the supervisor and othern - 1people take part in the game. For each person we know in how many r...
2019-06-15 21:54:00 234
原创 C. Bear and Prime Numbers
Recently, the bear started studying data structures and faced the following problem.You are given a sequence of integersx1, x2, ..., xnof lengthnandmqueries, each of them is characterized by t...
2019-06-13 21:14:18 325
原创 D. Mysterious Present
Peter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make achain. Chain here is such a sequence of envelopesA = {...
2019-06-13 17:12:58 575
原创 B. Working out
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrixawithnlines andmcolumns. Let numbera[i][j]represent...
2019-06-12 21:01:37 291 1
原创 D. Distance in Tree
Atreeis a connected graph that doesn't contain any cycles.Thedistancebetween two vertices of a tree is the length (in edges) of the shortest path between these vertices.You are given a tree wi...
2019-06-11 21:19:52 249
原创 C. Barcode
You've got ann × mpixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture.A picture is a barcode if the followin...
2019-06-11 11:35:32 419
原创 B. Bear and Blocks
One day, little Vasya found himself in a maze consisting of(n + 1)rooms, numbered from1to(n + 1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the(n + 1)-...
2019-06-10 22:30:43 156
原创 C. Vanya and Scales
Vanya has a scales for weighing loads and weights of massesw0, w1, w2, ..., w100grams wherewis some integer not less than2(exactly one weight of each nominal value). Vanya wonders whether he can ...
2019-06-09 21:50:15 279
原创 D. Ehab and the Expected XOR Problem
outputstandard outputGiven two integersnnandxx, construct an array that satisfies the following conditions:for any elementaiaiin the array,1≤ai<2n1≤ai<2n; there is nonon-emptysubs...
2019-06-06 22:47:00 268
原创 D. Bubble Sort Graph
Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation withnelementsa1,a2, ...,anin ascending order. He is bored of this so simple algorithm, so he invents his o...
2019-05-31 22:05:44 289
原创 E. Superhero Battle
A superhero fights with a monster. The battle consists of rounds, each of which lasts exactlynnminutes. After a round ends, the next round starts immediately. This is repeated over and over again....
2019-04-07 18:45:24 277
原创 A. The Beatles
Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle route going throughn⋅kcities. The cities are numerated from11ton⋅kn⋅k, the distance between the neighboring cities is e...
2019-04-07 18:36:05 7416
原创 E. Median String
You are given two stringsssandtt, both consisting of exactlykklowercase Latin letters,ssis lexicographically less thantt.Let's consider list of all strings consisting of exactlykklowercase...
2019-04-07 18:17:55 407 4
原创 Codeforces Round #547 (Div. 3) C D E
C. Polycarp Restores Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array of integersp1,p2,…,pnp1,p2,…,pnis cal...
2019-03-31 18:34:05 206
原创 [Offer收割]编程练习赛95
题目1 : 浇花问题描述小Hi在一条小路上种植了一排月季,总共有N株。这条小路的一端是一个水龙头。N株月季距离水龙头由近到远的距离依次是A1, A2, ... AN,每天需要浇水的量依次是B1, B2, ... BN。 现在小Hi有一个容量是C的水壶。他从水龙头出发,拎着灌满的水壶,依次去浇灌第1株、第2株、第3株…… 如果浇完第K株时,小Hi发现水壶中剩余的水量不足以浇灌第K+1株...
2019-03-16 14:11:01 308
原创 借书系统(简单)
要求:输入序号和书名查找书籍以及一些异常处理.思路:善用异常处理就okpackage library;import java.util.Scanner;public class librarysystem { public static void main(String[] args) { // TODO Auto-generated method stub String...
2019-02-25 11:28:21 1408
原创 java实现租车系统
要求:有客车,货车,皮卡三大类的车可以出租,实现出租车的数量,价格以及货物人数的一个报备。思路:先写个 车的抽象类然后在分别写出客车,货车,皮卡的类,再用super继承抽象类。 然后写个测试类实现租车系统的运行生成账单。car 抽象类package cars01;public abstract class car { String carName; int perso...
2019-02-25 10:10:22 5927 1
原创 Codeforces Global Round 1 D. Jongmah
You are playing a game of Jongmah. You don't need to know the rules to solve this problem. You have nntiles in your hand. Each tile has an integer between 11 and mm written on it.To win the game, yo...
2019-02-10 20:52:28 467
原创 Codeforces Global Round 1 E. Magic Stones
Grigory has nn magic stones, conveniently numbered from 11 to nn. The charge of the ii-th stone is equal to cici.Sometimes Grigory gets bored and selects some inner stone (that is, some stone with i...
2019-02-10 20:33:04 331
原创 Codeforces Round #536 (Div. 2) D. Lunar New Year and a Wander
Lunar New Year is approaching, and Bob decides to take a wander in a nearby park.The park can be represented as a connected graph with nn nodes and mm bidirectional edges. Initially Bob is at the no...
2019-02-10 20:15:48 316
原创 Codeforces Round #209 B. Permutation
A permutation p is an ordered group of numbers p1, p2, ..., pn, consisting of n distinct positive integers, each is no more than n. We'll define number n as the length of permutation p1, p2, ...
2019-01-19 22:49:36 176
原创 Codeforces Round #116 (Div. 2, C. Letter
Patrick has just finished writing a message to his sweetheart Stacey when he noticed that the message didn't look fancy. Patrick was nervous while writing the message, so some of the letters there wer...
2019-01-19 22:35:30 253
原创 Educational Codeforces Round 19 B. Odd sum
You are given sequence a1, a2, ..., an of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given seq...
2019-01-18 22:50:02 145
原创 B. Approximating a Constant Range
When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibrium. A good way to determine the equilibrium intensity would be ...
2019-01-17 21:27:09 262
原创 [Offer收割]编程练习赛88
题目3 : 字符替换描述给定一个只包含小写字母的初始字符串S,以及N个操作。每个操作都是把当前字符串中所有的字符Xi替换成字符Yi (Xi, Yi是一个小写字母),上一个操作的结果是下一个操作的对象。现在小Hi要对初始字符串完成所有N个操作,不过他可以任意安排N个操作的顺序。他希望最终得到的字符串中有最多的'h'字符。请你算出最多能得到多少个'h'字符。输入第一行包含一个整数N...
2018-12-26 19:16:52 201
原创 [Offer收割]编程练习赛88
题目2 : 增加得分描述小Hi在玩一款游戏,游戏中有N名玩家,每名玩家都有一个自己的当前分数A1, A2, ... AN。其中A1是小Hi的分数。 现在小Hi有2种方式提升自己的得分1. 将自己的得分A1直接增加1分。该方式会消耗X枚金币2. 从A2~AN中选则一名对手Ai,将自己的得分A1直接增加1分,对手Ai的得分减少1分。该方式会消耗Y枚金币。小Hi的目标是成为N名...
2018-12-26 19:03:17 207
原创 西北大学第四届程序设计竞赛新生赛(同步赛)(J)
链接:https://ac.nowcoder.com/acm/contest/321/J来源:牛客网 众所周知,八意永琳擅长制作药物.今天八意永琳又制作了很多份药物,但是由于材料组成的不同,最终的品级也会不同已知八意永琳制作的药物中,一共有n种不同的主材料,用1...n编号,每种主材料有ai种产地,每种产地都有自己的品级.每种主材料只取某个产地的一份,最终该药物的品级为所有主材料的...
2018-12-24 20:20:15 258
原创 python类的构建
现在软件的开发方式基本都是面向对象的,谈到对象就离不开类,类个人的理解就相当于一个你要造一个东西的模板,对象都是根据这个类构造出来的。python 构造类的写法class 类名(object): def __init__(self,属性值1,属性值2,...): self.属性值1=属性值1 self.属性值2=属性值2...
2018-11-26 21:25:35 519
原创 python 的输入输出
最近在看学python准备从爬虫入门,以前用的python2.7的版本,但现在用的python3.6还是原来的输入方式就一直错误,后来百度发现,现在的输入改成了字符串的形式所以每次要转换。输出的话今天学了一种新方式print(a,b,sep='\n') sep的设置就可以让你控制格式输出。刚刚那个是换行符 所以a,b在不同的行。...
2018-11-26 21:02:17 237
原创 Codeforces Round #523 (Div. 2) D. TV Shows
outputstandard outputThere are nn TV shows you want to watch. Suppose the whole time is split into equal parts called "minutes". The ii-th of the shows is going from lili-th to riri-th minute, bot...
2018-11-25 19:06:32 270
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人