- 博客(397)
- 资源 (1)
- 收藏
- 关注
原创 I - Harmonic Number (欧拉常数,调和级数,打表)
In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers:In this problem, you are given n, you have to find Hn. InputInput starts with an integer T (≤ 10000
2017-09-28 21:50:41 604
原创 H - Can you answer these queries?(线段树)
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of endu
2017-09-28 20:57:49 519
原创 Balanced Lineup(线段树+最大值,最小值)
Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 56970 Accepted: 26694 Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50
2017-09-28 19:47:09 792
原创 C - Aladdin and the Flying Carpet(算术基本定理)
It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magical
2017-09-27 09:49:45 1079 2
原创 E - Just a Hook(线段树+区间更新)
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length.Now Pudge want
2017-09-26 21:48:06 524
原创 D - Mayor's posters (线段树+离散化)
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally de
2017-09-26 20:06:16 358
原创 C - A Simple Problem with Integers (线段树lazy区间增减)
You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum
2017-09-25 18:44:39 285
原创 B - I Hate It(线段树)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0#include <iostream
2017-09-25 15:16:14 663
原创 A - 敌兵布阵(树状数组+线段树模板)
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以T
2017-09-23 20:52:16 395
原创 L - Fantasy of a Summation(快速幂)
If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.#include <stdio.h>int cases, caseno;in
2017-09-22 15:30:51 392
原创 A - A Dangerous Maze(期望)
You are in a maze; seeing n doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors.If you choose the ith door, it can either ta
2017-09-21 21:15:43 348
原创 U - Primes (素数筛)
Write a program to read in a list of integers and determine whether or not each number is prime. A number, n, is prime if its only divisors are 1 and n. For this problem, the numbers 1 and 2 are not co
2017-09-20 17:23:14 470
原创 E - Leading and Trailing (快速幂+double)
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
2017-09-20 16:55:26 681
原创 F - 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
2017-09-20 09:12:01 446
原创 Link/Cut Tree(大数)
Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which is based on Splay trees. Specifically, he is now studying the expose procedure.Unfortunately, Rostislav is unabl
2017-09-20 08:46:06 661
原创 A - Bi-shoe and Phi-shoe(素数筛)
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go
2017-09-20 08:42:02 417
原创 顺序表应用7:最大子段和之分治递归法
顺序表应用7:最大子段和之分治递归法 Time Limit: 10MS Memory Limit: 400KB Problem Description给定n(1<=n<=50000)个整数(可能为负数)组成的序列a[1],a[2],a[3],…,a[n],求该序列如a[i]+a[i+1]+…+a[j]的子段和的最大值。当所给的整数均为负数时定义子段和为0,依此定义,所求的最优值为: Max{0,
2017-09-19 08:12:19 377
原创 M - 昂贵的聘礼(Dijkstra)
年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其他的东西,他
2017-09-16 20:18:46 350
原创 O - Extended Traffic(SPFA)
Dhaka city is getting crowded and noisy day by day. Certain roads always remain blocked in congestion. In order to convince people avoid shortest routes, and hence the crowded roads, to reach destinati
2017-09-16 09:29:50 349
原创 K - Candies(差分约束)
During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the
2017-09-14 20:45:18 310
原创 J - Invitation Cards(spfa)
In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They h
2017-09-14 17:38:53 415
原创 2017 ACM/ICPC Asia Regional Shenyang transaction transaction transaction
transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 1454 Accepted Submission(s): 700Problem Description
2017-09-14 16:11:28 320
原创 Arbitrage(Floyd)
Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British
2017-09-13 20:40:01 411
原创 H - Cow Contest(Floyd闭包)
N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is uni
2017-09-13 19:39:38 296
原创 BAPC 2016 The 2016 Benelux Algorithm Programming Contest------I: Older Brother
I: Older Brother题目大意: 输入一个数,判断是否是任意一个素数的几次方~ 但是,我开始做的时候,先找了一遍素数,发现到10^7就输出不了了,应该是数据太大超时,我当时以为这种方法不对,又怀疑是不是自己读错题意了,然后又是李正确答案越来越远! 我不太明白的是,不用把10^9里的素数跑一遍吗???#include <iostream>#include <cstdio>#incl
2017-09-13 17:16:35 975
原创 BAPC 2016 The 2016 Benelux Algorithm Programming Contest-----L Sticky Situation
BAPC 2016 The 2016 Benelux Algorithm Programming Contest这次比赛真的是很丢人啊,开始的时候,自己真的是静不下心来,读题一点也不认真,看到英文真的是一点也不想翻译……觉得自己这样真的是很不好,要不断的调整。这次真的是做到心态崩了,以至于到最后,自己都放弃了,然后就一直想起假期的那件事,一边想要放弃,一边想要坚持,感觉自己都快分裂了,真的是很难受
2017-09-13 16:42:09 796
原创 2017 ACM/ICPC Asia Regional Shenyang card card card(补题)
As a fan of Doudizhu, WYJ likes collecting playing cards very much. One day, MJF takes a stack of cards and talks to him: let’s play a game and if you win, you can get all these cards. MJF randomly as
2017-09-10 20:24:52 509
原创 G - MPI Maelstrom(Dijkstra)
BIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a hierarchical communication subsystem. Valentine McKee's research advis
2017-09-10 19:25:06 340
原创 F - Wormholes(Bellman_Ford)
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is
2017-09-09 20:56:30 372
原创 E - Currency Exchange(Bellman_Ford)
Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can
2017-09-09 20:07:02 326
原创 D - Silver Cow Party(Dijkstra)
One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roa
2017-09-06 19:56:57 363
原创 C - Heavy Transportation(Dijkstra)
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 custo
2017-09-06 18:51:26 396
原创 B - Save the Students!
B - Save the Students! 题解:因为数据范围不大,避免重复计数,使用一个数组直接标记法即可。是否在圆内的判断使用到圆心的距离,遍历范围x±r,y±r,是否在正方形内直接判断,数据范围x->x+r,y->y+r,是否在三角形内部,需要用到一定的数学知识,一般有以下两种方法,一是利用面积来判断,对于三角形ABC,任取一个点M,连接M与ABC三个顶点,构成了三个三角形,三个三角形的和
2017-09-06 09:53:57 248
原创 J - Goblin Wars
J - Goblin Wars 题目大意:给出一幅图,’.’可以走,‘#’不能走,然后从‘a’—‘z’出发,如果只有一种字符可以到达(距离最短),则变成可以到达的字符,如果有多个字符可以到达,将其变为‘*’……#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>
2017-09-06 08:52:20 377
原创 K - The Unique MST(Kruskal判断最小生成树是否唯一)
Given a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G,
2017-09-04 22:02:29 961
原创 J - Borg Maze(BFS+Prim)
The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilization. Ea
2017-09-04 20:39:42 452
原创 简单时间转换(Python笔记)
简单时间转换 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Description这道题很简单,你只需要完成分和秒之间的转换即可。 保证输入输出数据均为正整数,且在 int 范围内。 Output一个整数,表示分。 Input一个整数,表示秒。 Example Output2 Exa
2017-08-25 21:21:22 369
原创 B - 英语考试 (Prim)
在过三个礼拜,YellowStar有一场专业英语考试,因此它必须着手开始复习。这天,YellowStar准备了n个需要背的单词,每个单词的长度均为m。YellowSatr准备采用联想记忆法来背诵这n个单词:1、如果YellowStar凭空背下一个新词T,需要消耗单词长度m的精力2、如果YellowSatr之前已经背诵了一些单词,它可以选择其中一个单词Si,然后通过联想记忆的方法去背诵新词T,需要消耗
2017-08-24 21:24:44 274
原创 Salty Fish
海边躺着一排咸鱼,一些有梦想的咸鱼成功翻身(然而没有什么卵用),一些则是继续当咸鱼。一个善良的渔夫想要帮这些咸鱼翻身,但是渔夫比较懒,所以只会从某只咸鱼开始,往一个方向,一只只咸鱼翻过去,翻转若干只后就转身离去,深藏功与名。更准确地说,渔夫会选择一个区间[L,R],改变区间内所有咸鱼的状态,至少翻转一只咸鱼。渔夫离开后想知道如果他采取最优策略,最多有多少只咸鱼成功翻身,但是咸鱼大概有十万条,所以这个
2017-08-24 20:37:01 259
原创 H - Highways (Prim)
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem and has already constructed a numbe
2017-08-24 19:57:14 287
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人