09 2017 档案
摘要:博客搬至 http://blog.csdn.net/littlewhite520
阅读全文
摘要:sd0061, the legend of Beihang University ACM-ICPC Team, retired last year leaving a group of noobs. Noobs have no idea how to deal with mm com...
阅读全文
摘要:题意:有n个区间,对于第i个区间[li,ri]有liusing namespace std;namespace IO { const int MX = 4e7; //1e7占用内存11000kb char buf[MX]; int c, sz; void...
阅读全文
摘要:You are given an matrix M (consisting of nonnegative integers) and an integer K. For any submatrix of M’ of M define min(M’) to be the minimu...
阅读全文
摘要:B. The Bakery time limit per test2.5 seconds memory limit per test256 megabytes inputstandard input outputstandard outputSome time ago Slastyo...
阅读全文
摘要:You are given an array AA , and Zhu wants to know there are how many different array BB satisfy the following conditions?1≤Bi≤Ai1≤Bi≤Ai For ea...
阅读全文
摘要:Recently Duff has been a soldier in the army. Malek is her commander.Their country, Andarz Gu has n cities (numbered from 1 to n) and n - 1 bi...
阅读全文
摘要:题意:求正方体 n*n*n,固定其中一个点在(0,0,0) 问在正方体里又多少不同的直线。这个题的难点是如果排除掉重复的直线 例如 4,4,4 那么 2,2,2 和 4, 4,4 是相同的推荐两个博客:http://blog.csdn.net/lixuepeng_001/articl...
阅读全文
摘要:Given 5 integers: a, b, c, d, k, you’re to find x in a…b, y in c…d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y....
阅读全文
摘要:HDU1695的题目大意是这样的,给你 a , b , c , d , k 五个值 (题目说明了 你可以认为 a=c=1) x 属于 [1,b] ,y属于[1,d] 让你求有多少对这样的 (x,y)满足gcd(x,y)==k。这一题和hdu 6053不一样的地方在于,在hdu60...
阅读全文
摘要:In ACM/ICPC contest, the ”Dirt Ratio” of a team is calculated in the following way. First let’s ignore all the problems the team didn’t pass, ...
阅读全文
摘要:Give you an array A[1..n]A[1..n],you need to calculate how many tuples (i,j,k) (i,j,k) satisfy that (i j 的情况 只要把每次更新的ak的时候把前面的所有的数都当成是非法...
阅读全文
摘要:Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异...
阅读全文
摘要:给定整数N,求1using namespace std;const int maxn=1e7+10; bool vis[maxn]; int prime[maxn],mu[maxn]; int cnt; typedef long long ll;void Init(){ ...
阅读全文
摘要:You 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....
阅读全文
摘要:转自:http://blog.csdn.net/cysjiang/article/details/76090902题意: 给你一个a序列,代表0到n-1的排列;一个b序列代表0到m-1的排列。问你可以找出多少种函数关系,满足f(i)=b[f(a[i])]; 分析:这个主要是找循环...
阅读全文
摘要:On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cav...
阅读全文
摘要:Background To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker. The premis...
阅读全文
摘要:给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权。其中lastans是上一个询问的答案,初始为0,即第一个询问的u是明文。Input 第一行两个整数N,M。 第二行有N个整数,其中第i个整数表示点i的...
阅读全文
摘要:总算是把动态求区间第k个数的算法看明白了。 在主席树的基础上,如果有修改操作,则要通过套树状数组来实现任意区间求第k小的问题。 刚开始看不明白什么意思,现在有一点理解。树状数组的每个元素是一个线段树,来维护修改后的前后缀和,树状数组能在log时间内更整个数组,现在用相同的方式更新整个...
阅读全文
摘要:Mr. Frog has an integer sequence of length n, which can be denoted as a1,a2,⋯,ana1,a2,⋯,anThere are m queries. In the i-th query, you are given two in...
阅读全文
摘要:很明显 主席树:是一个需要离散化的过程,一棵树就是整个所有序列的离散后的值, 然后从sum中开始找// 题意// 给出一个序列,m组查询,对每个查询(i, j, k)需要输出区间[i, j]中第k大的数。// 题解// 主席树的入门题。 // 主席树其实就是可持久化线段树,比如现有...
阅读全文
摘要:题意:给出一个字符串,求出第k小的子串,并求出字符串的起止位置,如果有多个重复的子串,求出位置最靠左的子串。 思路:比赛时,想到了要用后缀数组,但是没想到如何做。 其实,因为子串是后缀的前缀,后缀数组对后缀排序的同时,也对子串进行了排序。对于每一个sa[i],会产...
阅读全文
摘要:Fat brother and Maze are playing a kind of special (hentai) game with two integers. All the digits of these two integers are in the range from...
阅读全文
摘要:You should process m queries over a set D of strings. Each query is one of three kinds:Add a string s to the set D. It is guaranteed that the ...
阅读全文
摘要:Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fi...
阅读全文
摘要:ob has a dictionary with N words in it. Now there is a list of words in which the middle part of the word has continuous letters disappeared....
阅读全文
摘要:Liyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know the passwor...
阅读全文
摘要:Given two sequences of numbers : a[1], a[2], …… , a[N], and b[1], b[2], …… , b[M] (1 using namespace std;const int maxn=100100 ;int f[maxn]; v...
阅读全文
摘要:Mr. Cui is working off-campus and he misses his girl friend very much. After a whole night tossing and turning, he decides to get to his girl ...
阅读全文
摘要:#include#define ll long longusing namespace std; const int maxn=100005;const int BUF=30000000;char Buf[BUF],*buf=Buf;inline void read(int&a){for(a=0;*...
阅读全文
摘要:Do you like painting? Little D doesn’t like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing ...
阅读全文
摘要:Zero and One are good friends who always have fun with each other. This time, they decide to do something on a tree which is a kind of graph that ther...
阅读全文
摘要:Problem I: qwb VS 去污棒 Time Limit: 2 Sec Memory Limit: 256 MB Submit: 95 Solved: 36 [Submit][Status][Web Board] Descriptionqwb表白学姐失败后,郁郁寡欢,...
阅读全文
摘要:题意:给定一个数组,求区间中位数,保证给定区间长度是奇数思路:划分树求区间中位数#include #include #include #include using namespace std;#define MAX_SIZE 100005 int sorted[MAX_SIZE];//已经排好序的...
阅读全文
摘要:There is a tree with nn nodes, each of which has a type of color represented by an integer, where the color of node ii is cici. The path betwe...
阅读全文
摘要:1239 欧拉函数之和 基准时间限制:3 秒 空间限制:131072 KB 分值: 320 难度:7级算法题 对正整数n,欧拉函数是小于或等于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为Euler’s totient function、φ函数、欧拉商数等。例如:...
阅读全文
摘要:lyk有两序列a和b。 lyk想知道存在多少对x,y,满足以下两个条件。 1:gcd(x,y)=1。 2: abxabx = baybay 。例如若a={1,1,1},b={1,1,1}。那么存在7对,因为除了x=2,y=2或x=3,y=3外都满足条件。 Input 第一行一个数...
阅读全文
摘要:莫比乌斯函数,由德国数学家和天文学家莫比乌斯提出。梅滕斯(Mertens)首先使用μ(n)(miu(n))作为莫比乌斯函数的记号。具体定义如下: 如果一个数包含平方因子,那么miu(n) = 0。例如:miu(4), miu(12), miu(18) = 0。 如果一个数不包含平方因...
阅读全文
摘要:bool book[N]; int prime[N],euler[N]; int res; void eratosthenes_sieve() { res=0; memset(book,false,sizeof(book)); for(int i=2;i<m...
阅读全文
摘要:Claris loves painting very much, so he painted a tree with beautiful colors. The tree is a rooted tree with nn nodes which are conveniently la...
阅读全文
摘要:As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:...
阅读全文
摘要:Given a binary string S[1,…,N]S[1,…,N] (i.e. a sequence of 0’s and 1’s), and QQ queries on the string. There are two types of queries: Flippin...
阅读全文
摘要:In computer vision, a chain code is a sequence of numbers representing directions when following the contour of an object. For example, the fo...
阅读全文
摘要:Lulu has a sweet tooth. Her favorite food is ring donut. Everyday she buys a ring donut from the same bakery. A ring donut is consists of nn p...
阅读全文
摘要:https://loj.ac/problem/528不含平方因子的数才会有 -1 和 1才会对结果造成影响, 所有排除掉所有含有平方因子的数就好开始的时候平方是1 就是没有平方因子的情况,减去所有平方因子的情况#include using namespace std;const in...
阅读全文
摘要:int miniexpress (char* s, int n) { int p = 0, q = 1; while (p 0) j=j+k+1; else i=i+k+...
阅读全文
摘要:题意:我们定义d(a,b)为a通过乘除最少的素数到达b。比如d(15,50)=3,15*2*5/3=50。我们定义3个操作和一个空的集合s:I x表示在集合s里插入一个x,如果存在x,忽略这个操作。D x表示在集合x里删除x,如果不存在x,忽略这个操作。Q x找到最小的z集合里面存在一个y,使得d(...
阅读全文
摘要:There are n villages along a high way, and divided the high way into n-1 segments. Each segment would charge a certain amount of money for bei...
阅读全文
摘要:时间限制:15000ms 单点时限:3000ms 内存限制:512MB 描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一段音乐旋律可以被表示为一段数构成的数列。神奇的是小Hi发现了一部名字叫《十进制进行曲大全》的作品集,顾名思义,这部作品集里有许多作品,但是所有的作品有一个共同特...
阅读全文
摘要:描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为一段数构成的数列。现在小Hi想知道一部作品中所有长度为K的旋律中出现次数最多的旋律的出现次数。但是K不是固定的,小Hi想知道对于所有的K的答案。解题方法提示输入共一行,包含一个由小写字母构成的字符串S。字符串长度不...
阅读全文
摘要:时间限制:10000ms 单点时限:2000ms 内存限制:512MB 描述小Hi平时的一大兴趣爱好就是演奏钢琴。我们知道一个音乐旋律被表示为一段数构成的数列。现在小Hi想知道一部作品中出现了多少不同的旋律?#include#include#include#define rg reg...
阅读全文
摘要:string string string Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 801 Accepted ...
阅读全文
摘要:Chip Factory Time Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 3409 Accepted Subm...
阅读全文
摘要:转: http://blog.csdn.net/xzxxzx401/article/details/52196950 题意很明确是线段树,需要三种操作:区间更新(加值),区间开根号,区间求和。区间开根号就是区间内部每一个值开根号。思路先膜吧:我和这个大佬的代码风格很像,所以看的很舒服...
阅读全文
浙公网安备 33010602011771号