- 博客(68)
- 收藏
- 关注
原创 CSU天梯赛校赛 L3-1 Hashing - Hard Version
Hashing - Hard VersionL3-1 Hashing - Hard Version (30 分)Given a hash table of size N, we can define a hash function H(x)=x%N. Suppose that the linear probing is used to solve collisions, we can e...
2019-03-19 13:15:55 233
原创 Planning - Codeforces - 854C
PlanningHelen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of
2017-09-16 23:10:47 354
原创 Make Palindrome - Codeforces - 600C
Make PalindromeA string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but st
2017-09-13 21:13:35 327
原创 Queries about less or equal elements - Codeforces - 600B
Queries about less or equal elementsYou are given two arrays of integers a and b. For each element of the second array bj you should find the number of elements in array a that are less than or equal t
2017-09-13 20:36:19 530
原创 Extract Numbers - Codeforces - 600A
Extract NumbersYou are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and ';' (semicolon). For example, there are four words in string "aba,123;
2017-09-13 20:23:37 379
原创 Kingdoms - UVALive - 6255
Kingdoms题意:有编号1..n的国家,之间以有向边连接,边的信息表示了一个国家对另一个国家的负债和债权情况。现在寻找资不抵债(破产)的国家,将其从图中抹去,这样它的负债和债权也被一并抹去。问,重复进行上述操作后有哪些国家可能是最终剩下的那一个。若有,则按它们编号的升序输出;若无,则输出0。思路:采用一种枚举的思路,用dfs枚举破产国家的各种组合,状态就用二十位的二进制位来表示:1表示破产,0表
2017-09-13 20:09:15 301
原创 Darts - UVALive 6262
Darts题意:向靶心位于原点的圆形靶投掷飞镖。给一组坐标,表示飞镖的落点,落在靶上则得分,脱靶不计分。计算最终得分。思路:算出飞镖落点,算出落点与靶心的距离,向上取整,按给定得分规则计分即可。#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#include
2017-09-13 07:56:31 339
原创 CSU-ACM2017暑假集训比赛8 - E - Escape - HDU - 3605
E - Escape 2012 If this is the end of the world how to do? I do not know how. But now scientists have found that some stars, who can live, but some people do not fit to live some of the planet. Now sci
2017-08-27 22:31:04 286
原创 CSU-ACM2017暑假集训比赛8 - D - Fleet of the Eternal Throne HDU - 6138
D - Fleet of the Eternal Throne The Eternal Fleet was built many centuries ago before the time of Valkorion by an unknown race on the planet of Iokath. The fate of the Fleet’s builders is unknown but
2017-08-27 21:49:05 265
原创 CSU-ACM2017暑假集训比赛8 - C - GCD Table - CodeForces - 582A
C - GCD TableThe GCD table G of size n × n for an array of positive integers a of length n is defined by formula Let us remind you that the greatest common divisor (GCD) of two positive integers x a
2017-08-27 11:37:00 223
原创 CSU-ACM2017暑假集训比赛8 - B - The Two Routes - CodeForces - 601A
B - The Two RoutesIn Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there
2017-08-27 10:08:20 446
原创 CSU-ACM2017暑假集训比赛8 - A - Xor Sum - HDU - 4825
A - Xor Sum Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。Prometheus 为了让 Zeus 看到人类的伟大,随即同意 Zeus 可以向
2017-08-26 23:17:12 298
原创 CSU-ACM2017暑假集训比赛7 - F - 凑数字 - 51Nod - 1385
F - 凑数字给定一个n,要求找出一个最短的字符串S,使得所有1到n的整数都是S的子序列。比如n=10,那么S=”1234056789”的时候,是满足条件的。这个时候S的长度是10。现在给出一个n,要求输出最短S的长度。Input第1行:给出一个整数n (1<=n<=1e10000)。Output输出最短S的长度Sample Input10Sample Output10首先容易想到,将一个
2017-08-23 20:33:46 528
原创 CSU-ACM2017暑假集训比赛7 - E - Courses - HDU - 1083
E - Courses Consider a group of N students and P courses. Each student visits zero, one or more than one courses. Your task is to determine whether it is possible to form a committee of exactly P stude
2017-08-23 19:55:48 351
原创 CSU-ACM2017暑假集训比赛7 - D - Bicoloring - UVA - 10004
D - Bicoloring一边深度优先搜索,一边染色,一边检查是否有相邻节点染上了相同颜色即可。也可以理解为染色法判断二分图是否成立。#include <iostream>#include <cstdio>#include <algorithm>#include <vector>#include <cstring>#include <queue>using namespace std;
2017-08-23 19:40:37 289
原创 CSU-ACM2017暑假集训比赛7 C - Pasha and Tea - CodeForces - 557B
C - Pasha and TeaPasha decided to invite his friends to a tea party. For that occasion, he has a large teapot with the capacity of w milliliters and 2n tea cups, each cup is for one of Pasha's friends.
2017-08-23 19:34:08 369
原创 CSU-ACM2017暑假集训比赛7 B - Raising Bacteria - CodeForces - 579A
B - Raising BacteriaYou are a lover of bacteria. You want to raise some bacteria in a box.Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, eve
2017-08-23 17:47:33 383
原创 CSU-ACM2017暑假集训比赛7 A - Equivalent Strings - CodeForces - 560D
A - Equivalent StringsToday on a lecture about strings Gerald learned a new definition of string equivalency. Two strings a and b of equal length are called equivalent in one of the two cases: They
2017-08-23 17:09:25 402
原创 CSU-ACM2017暑期训练16-树状数组 G - KiKi's K-Number HDU - 2852
G - KiKi’s K-Number For the k-th number, we all should be very familiar with it. Of course,to kiki it is also simple. Now Kiki meets a very similar problem, kiki wants to design a container, the cont
2017-08-14 22:35:32 218
原创 CSU-ACM2017暑期训练16-树状数组 F - Matrix Sum HihoCoder - 1336
F - Matrix SumYou are given an N × N matrix. At the beginning every element is 0. Write a program supporting 2 operations: 1. Add x y value: Add value to the element Axy. (Subscripts starts from 02. Su
2017-08-14 22:26:53 232
原创 CSU-ACM2017暑期训练16-树状数组 D - 斜率小于0的连线数量 51Nod - 1107
D - 斜率小于0的连线数量二维平面上N个点之间共有C(n,2)条连线。求这C(n,2)条线中斜率小于0的线的数量。二维平面上的一个点,根据对应的X Y坐标可以表示为(X,Y)。例如:(2,3) (3,4) (1,5) (4,6),其中(1,5)同(2,3)(3,4)的连线斜率 < 0,因此斜率小于0的连线数量为2。Input第1行:1个数N,N为点的数量(0 <= N <= 50000)第2
2017-08-14 22:23:13 194
原创 CSU-ACM2017暑期训练16-树状数组 B - Stars POJ - 2352
B - StarsAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not hig
2017-08-14 22:11:34 244
原创 CSU-ACM2017暑期训练16-树状数组 C - 按钮控制彩灯实验 CSU - 1770
C - 按钮控制彩灯实验应教学安排,yy又去开心的做电学实验了。实验的内容分外的简单一串按钮通过编程了的EEPROM可以控制一串彩灯。然而选择了最low的一种一对一的控制模式,并很快按照实验指导书做完实验的yy马上感觉到十分无趣。于是他手指在一排按钮上无聊的滑来滑去,对应的彩灯也不断的变化着开关。已知每一个按钮按下会改变对应一个彩灯的状态,如此每次yy滑动都会改变一串彩灯的状态。现已知彩灯最初的状态
2017-08-14 21:58:29 319
原创 CSU-ACM2017暑期训练16-树状数组 A - Ultra-QuickSort POJ - 2299
A - Ultra-QuickSortIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the se
2017-08-14 21:41:02 190
原创 CSU-ACM2017暑期训练16-树状数组 H - Bubble Sort HDU - 5775
H - Bubble Sort P is a permutation of the integers from 1 to N(index starting from 1).Here is the code of Bubble Sort in C++.for(int i=1;i<=N;++i) for(int j=N,t;j>i;—j) if(P[j-1] > P[j])
2017-08-14 21:35:50 351
原创 CSU1980: 不堪重负的树
CSU1980: 不堪重负的树Description小X非常喜欢树,然后他生成了一个大森林给自己玩。玩着玩着,小X陷入了沉思。一棵树由N个节点组成,编号为i的节点有一个价值Wi。假设从树根出发前往第i个节点(可能是树根自己),一共需要经过Di个节点(包括起点和终点),那么这个节点对这棵树产生的负担就是Di与Wi的乘积。对于一棵树而言,这棵树的负担值为所有节点对它产生的负担之和。小X学习了dfs
2017-08-13 22:12:35 287
原创 CSU1979: 古怪的行列式
CSU1979: 古怪的行列式Description这几天,子浩君潜心研究线性代数。 行列式的值定义如下:其中,τ(j1j2...jn)为排列j1j2...jn的逆序数。子浩君很厉害的,但是头脑经常短路,所以他会按照行列式值的定义去计算,这个行列式子浩君也还是能算对的。但是,在计算的过程中,如果出现连续三行选取的元素为83(S),83(S),82(R)的话,子浩君会忍不住拿走它们:-D,然后这三个
2017-08-13 19:19:51 400
原创 CSU1978: LXX的图论题
CSU1978: LXX的图论题Description由于lxx的图论和数据结构太弱了,大佬Z决定为lxx补一补。于是大佬Z为lxx出了一道题目,题目如下:给出一张有向图,图中有n个点,m条边,每条边上都有一个权值w,问图中是否存在满足以下条件的点i,j,...p使得不等式w[i][j] * w[j][k] * .... * w[p][i]<1成立。奈何lxx太弱了,他决定寻求你的帮助。Input
2017-08-13 09:08:56 454
原创 CSU1977: Bit-reversal Permutation
CSU1977: Bit-reversal PermutationDescriptionA fast Fourier transform (FFT) algorithm computes the discrete Fourier transform (DFT) of a sequence, or its inverse (IFFT). Fourier analysis converts a sign
2017-08-13 08:59:05 462
原创 CSU1976: 搬运工小明
CSU1976: 搬运工小明Description作为老人的小明非常忧伤,因为他马上要被流放到本部去了,住进全左家垅最有历史感的11舍真是一件非常荣幸的事情。搬行李是个体力活,小明发现自己的行李太多啦,所以他决定去买很多个袋子来装走。到了超市的小明发现,不同大小的袋子居然价格一样???虽然买最大的自然最赚,但是小明是名远近闻名的环保人士,他觉得袋子只要能装下他的行李就够了,并且为了不麻烦收银的小姐
2017-08-13 08:39:09 591
原创 CSU-ACM2017暑期训练14-最短路 D - 输入量很大的模板题
D - 输入量很大的模板题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 Com
2017-08-11 17:54:38 418
原创 CSU-ACM2017暑期训练12-KMP G - Next[]树 CodeForces - 432D
G - Next[]树 CodeForces - 432DYou have a string s = s1s2...s|s|, where |s| is the length of string s, and si its i-th character.Let's introduce several definitions: A substring s[i..j] (1 ≤ i ≤ j ≤ |
2017-08-08 22:15:26 344
原创 CSU-ACM2017暑期训练12-KMP H - 结合dp
H - 结合dp As is known to all, in many cases, a word has two meanings. Such as “hehe”, which not only means “hehe”, but also means “excuse me”.Today, ?? is chating with MeiZi online, MeiZi sends a sente
2017-08-08 22:13:38 268
原创 CSU-ACM2017暑期训练12-KMP F - 前缀后缀
F - 前缀后缀Asterix, Obelix and their temporary buddies Suffix and Prefix has finally found the Harmony temple. However, its doors were firmly locked and even Obelix had no luck opening them.A little later
2017-08-08 22:07:51 381
原创 CSU-ACM2017暑期训练12-KMP E - 循环
E - 循环 For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each
2017-08-08 22:05:15 255
原创 CSU-ACM2017暑期训练12-KMP D - 匹配
D - 匹配The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pair normal, mais tout
2017-08-08 21:59:14 317
原创 Problem - 557C - Codeforces - Arthur and Table
Arthur and TableArthur has bought a beautiful big table into his new flat. When he came home, Arthur noticed that the new table is unstable.In total the table Arthur bought has n legs, the length of th
2017-08-06 10:36:49 331
原创 CSU-ACM2017暑假训练9-区间DP G - String painter
G - String painter There are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change
2017-08-05 08:14:13 458
原创 CSU-ACM2017暑假训练9-区间DP F - Running
F - RunningThe cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or rest for the whole
2017-08-05 08:11:42 260
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人