
容斥原理
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【 HDU - 1796】How many integers can you find (容斥原理,二进制枚举或者dfs)
题干: Now you get a number N, and a M-integers set, you should find out how many integers which are small than N, that they can divided exactly by any integers in the set. For example, N=12, and M-in...原创 2018-10-31 22:03:36 · 247 阅读 · 0 评论 -
【ZOJ - 2836 】Number Puzzle (容斥原理)
题干:Given a list of integers (A1, A2, ..., An), and a positive integer M, please find the number of positive integers that are not greater than M and dividable by any integer from the given list. ...原创 2018-11-02 15:30:54 · 553 阅读 · 0 评论 -
【CodeForces - 245H 】Queries for Number of Palindromes (带容斥的区间dp)
题干:You've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There also are q queries, each query is described by two integers li, ri (1 ≤ li ≤ ri ≤ |s|). The answ...原创 2018-12-07 22:15:12 · 305 阅读 · 0 评论 -
【EOJ Monthly 2018.12 - A,B,C】套题训练,部分题解
A.题干:A. 仰望星空单测试点时限: 2.0 秒内存限制: 512 MB你就这样静坐在草地上,离我稍远的地方。我用眼角瞅着你,你什么话也别说。语言是误会的根源。但是,每天,你可以坐得离我近一些……你和她一起仰头仰望着布满星辰的天空。你的星星对她而言只不过是众星中的一颗。她会喜欢仰望天际所有的繁星,他们都会是她的朋友。但你深信你不会是万众中一颗毫不起眼的星...原创 2018-12-07 22:25:21 · 708 阅读 · 0 评论 -
【牛客 - 181F】子序列(容斥,组合数,费马小定理)
题干:题目描述给出一个长度为n的序列,你需要计算出所有长度为k的子序列中,除最大最小数之外所有数的乘积相乘的结果 输入描述:第一行一个整数T,表示数据组数。对于每组数据,第一行两个整数N,k,含义如题所示接下来一行N个整数,表示给出的序列保证序列内的数互不相同输出描述:对于每组数据,输出一个整数表示答案,对取模每组数据之间以换行分割 示例...原创 2019-02-19 11:51:35 · 301 阅读 · 0 评论 -
【牛客 - 696C】小w的禁忌与小G的长诗(dp 或 推公式容斥)
题干:链接:https://ac.nowcoder.com/acm/contest/696/C来源:牛客网自从上次小w被奶牛踹了之后,就一直对此耿耿于怀。于是"cow"成为了小w的禁忌,而长得和"cow"很像的"owc"…凡是同时含有"c","w","o"的都进入了他的禁忌名单。小G想给他送一幅幅长为n个字符的长诗,但是又怕触犯他的禁忌。所以他决定要是诗中出现了他的禁忌就宁可...原创 2019-05-02 22:56:49 · 342 阅读 · 0 评论 -
【HDU - 5468】Puzzled Elena(容斥原理,dfs序,数学,素因子分解,有坑)
题干: Problem Description Since both Stefan and Damon fell in love with Elena, and it was really difficult for her to choose. Bonnie, her best friend, suggested her to throw a question to them,...原创 2019-07-15 14:37:22 · 252 阅读 · 0 评论