A. Ebony and Ivory 题目连接: http://www.codeforces.com/contest/633/problem/A Description Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, Ebony and Ivory, each of t…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dante is engaged in a fight with "The Savior". Before he can fight it with his sword, he needs to break its shields. He has two guns, E…
暴力 A - Ebony and Ivory import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner (new BufferedInputStream (System.in)); int a = cin.nextInt (); int b = cin.nextInt (); int c = cin.nex…
D. Fibonacci-ish time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if th…
B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks f…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't u…
题目链接:http://codeforces.com/problemset/problem/633/G 大意是一棵树两种操作,第一种是某一节点子树所有值+v,第二种问子树中节点模m出现了多少种m以内的质数. 第一种操作非常熟悉了,把每个节点dfs过程中的pre和post做出来,对序列做线段树.维护取模也不是问题.第二种操作,可以利用bitset记录质数出现情况.所以整个线段树需要维护bitset的信息. 对于某一个bitset x,如果子树所有值需要加y,则x=(x<<y)|(x>>…
题目链接:http://codeforces.com/problemset/problem/633/C 大意就是给个字典和一个字符串,求一个用字典中的单词恰好构成字符串的匹配. 比赛的时候是用AC自动机写的,就是对于trie中每一个节点,判断是否为终结点,以及当前字符所在位置p减去trie中这个节点的深度也即某一单词的长度l,判断dp[p-l]是否可以被构成,可以的话直接break并且标记当前dp值. 赛后想了想,其实直接一个trie就行了,每个单词才1000的长度,又想起来我去年给人讲过类似的…
数学技巧真有趣,看出规律就很简单了 wa 题意:给出数k  输出所有阶乘尾数有k个0的数 这题来来回回看了两三遍, 想的方法总觉得会T 后来想想  阶乘 emmm  1*2*3*4*5*6*7*8*9*10...*n 尾数的0只与5有关 是5的几倍就有几个0  因为5前面肯定有偶数 乘起来就有一个0 而且最后输出肯定是连续的5个 hhh 兴奋 开始上手 乱搞一下  发现复杂度还行 测样例 发现 k=5 的时候不对了 输出25~29了 应该是0的 咦  测了一下 25!应该是6个0的 25=5*5…
H. Fibonacci-ish II 题目连接: http://codeforces.com/contest/633/problem/H Description Yash is finally tired of computing the length of the longest Fibonacci-ish sequence. He now plays around with more complex things such as Fibonacci-ish potentials. Fibo…