Codeforces 833 C - Ever-Hungry Krakozyabra】的更多相关文章

思路: 首先,inedible tails 的个数最多为C(18+9,9)个(用隔板法),所以我们暴力出所有的 inedible tails,然后检查一下在[L, R]这段区间是否存在这个inedible tails 检查的时候用了和数位dp差不多的方法,设一个下界和上界,只要之前的既没有达到上界也没有达到下界,后面就可以随便填了,说明存在 #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #inclu…
A. Hungry Student Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some frie…
Codeforces Round #833 (Div. 2) D. ConstructOR 知识点:高位和对低位无影响 一开始以为和广州的M一样,是数位dp,后来发现只要找到一个就行 果然无论什么时候都要看清题目 这时候还是没有什么思路,然后就看了题解的提示:当a和b有奇数时,d为偶数一定不可以 那显然这个结论可以继续推广,比较a,b,d的二进制后导0的大小即可 当a,b,d都截去d的后导0时,此时d为奇数 那么我们可以再次应用高位计算不会对低位产生影响这个条件 直接观察 \(a|b\) 如果当…
题目链接:http://codeforces.com/problemset/problem/327/B 这道题目虽然超级简单,但是当初我还真的没有想出来做法,囧,看完别人的代码恍然大悟. #include <cstdio> #include <cstdlib> #include <cmath> int main(void) { int n; scanf("%d", &n); ; i <= n+n; ++i) { printf("…
. Hungry Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money,…
题目链接 题目就是让你输出n个数的序列,要保证该序列是递增的,并且第i个数的前面不能保护它的约数,我直接先对前100000的素数打表,然后输出前n个,so easy. //cf 191 B #include <stdio.h> #include <string.h> int ans[100005]; bool vis[10000000]; int main() { int cnt = 1; for (int i = 2; i < 1300000; i++) { if (vis…
比赛链接 A 题解 知识点:数学. 注意到 \(n\) 为奇数时,不考虑连续性,一共有 \(\lceil \frac{n}{2} \rceil ^2\) 个格子,接下来证明一定能凑成方块. 从下往上从大到小摆,第 \(1\) 层摆 \(1 \times \lceil \frac{n}{2} \rceil\) 的矩形,第 \(i\geq 2\) 层显然可以成对摆放 \(1 \times \lceil \frac{n-i}{2} \rceil\) 和 \(1\times (\lceil \frac{…
A. Guest From the Past 题目连接: http://www.codeforces.com/contest/625/problem/A Description Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found hi…
B. Laurenty and Shop Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/problem/B Description A little boy Laurenty has been playing his favourite game Nota for quite a while and is now very hungry. The boy wants to make sa…
E. Caramel Clouds time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output It is well-known that the best decoration for a flower bed in Sweetland are vanilla muffins. Seedlings of this plant need…