上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: 题目链接:https://vijos.org/p/1062 题意:输入n(n <= 1500)个女生左边有多少个男生。每个女生都和她左边最近的男生跳舞。 输出每个女生到可以与之跳舞的男生之间有几个男生;(包括跳舞的男生) input 64 5 6 6 6 6output 1 1 1 4 5 6 思路 阅读全文
posted @ 2016-03-18 00:02 hxer 阅读(499) 评论(0) 推荐(0) 编辑
摘要: 对于正整数n,定义f(n)为n所含质因子的最大幂指数。例如f(1960)=f(2^3 * 5^1 * 7^2)=3, f(10007)=1, f(1)=0。 给定正整数a,b,求sigma(sigma(f(gcd(i,j)))) (i=1..a, j=1..b)。 第一行一个数T,表示询问数。 接下 阅读全文
posted @ 2016-03-17 23:45 hxer 阅读(1097) 评论(0) 推荐(0) 编辑
摘要: 题意:给出n, m, p,求有多少对a, b满足gcd(a, b)的素因子个数<=p,(其中1<=a<=n, 1<=b<=m) 有Q组数据;(n, m, P <= 5×105. Q <=5000). 参考:ACdreamers 思路:对于hdu1695 GCD来说,由于只需要求gcd = k的个数, 阅读全文
posted @ 2016-03-16 17:05 hxer 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 题意:输入5个数a,b,c,d,k;(a = c = 1, 0 < b,d,k <= 100000);问有多少对a <= p <= b, c <= q <= d使得gcd(p,q) = k; 注:对于(p,q)和(q,p)只算一次; 思路:由于遍历朴素求两个数的gcd的时间复杂度为O(n^2*log 阅读全文
posted @ 2016-03-15 23:36 hxer 阅读(176) 评论(0) 推荐(0) 编辑
摘要:   阅读全文
posted @ 2016-03-15 08:50 hxer 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 题意:给定fibonacci数列的前100000项的前n位(n<=40);问你这是fibonacci数列第几项的前缀?如若不在前100000项范围内,输出-1; 思路:直接使用数组模拟加法,再用Trie树插入查找即可;但是一般使用new Trie()的代码都是MLE的。反而我之前写的,直接得到数组大 阅读全文
posted @ 2016-03-15 00:43 hxer 阅读(286) 评论(0) 推荐(0) 编辑
摘要: C. Table Compression Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many others. Inspired 阅读全文
posted @ 2016-03-14 18:41 hxer 阅读(375) 评论(0) 推荐(0) 编辑
摘要: Clairewd’s message 题意:先一个转换表S,表示第i个拉丁字母转换为s[i],即a -> s[1];(a为明文,s[i]为密文)。之后给你一串长度为n<= 100000的前面为密文后面为明文的串;让你通过密码转换表S在这个串的后面添加字符,使得前面的密文翻译成明文之后与后面相对应,最 阅读全文
posted @ 2016-03-12 19:31 hxer 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Simpsons’ Hidden Talents Problem Description Write a program that, when given strings s1 and s2, finds the longest prefix of s1 that is a suffix of s2 阅读全文
posted @ 2016-03-12 15:46 hxer 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 剪花布条 Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见 阅读全文
posted @ 2016-03-12 14:08 hxer 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Cyclic Nacklace 题意:给一个长度为Len( 3 <= Len <= 100000 )的英文串,问你在字符串后面最少添加几个字符可以使得添加后的串为周期串? Sample Input 3 aaa abca abcde Sample Output 0 2 5 思路:要是写过period再 阅读全文
posted @ 2016-03-12 13:53 hxer 阅读(202) 评论(0) 推荐(0) 编辑
摘要: Period 题意:一个长为N (2 <= N <= 1 000 000) 的字符串,问前缀串长度为k(k > 1)是否是一个周期串,即k = A...A;若是则按k从小到大的顺序输出k即周期数; Sample Input 3 aaa 12 aabaabaabaab 0 Sample Output 阅读全文
posted @ 2016-03-12 11:20 hxer 阅读(578) 评论(0) 推荐(0) 编辑
摘要: Count the string Problem Description It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string 阅读全文
posted @ 2016-03-12 10:59 hxer 阅读(205) 评论(0) 推荐(0) 编辑
摘要: Watchmen 题意:有n (1 ≤ n ≤ 200 000) 个点,问有多少个点的开平方距离与横纵坐标的绝对值之差的和相等; 即 = |xi - xj| + |yi - yj|.(|xi|, |yi| ≤ 109) 思路:开始想的是容斥原理,即按x,y分别排序,先计算同x的点,然后在计算同y的点 阅读全文
posted @ 2016-03-11 15:22 hxer 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by sw 阅读全文
posted @ 2016-03-11 14:43 hxer 阅读(389) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页