codeforces 659C Tanya and Toys】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/659/C 题意: n是已经有的数字,m是可用的最大数字和 要求选自己没有的数字,且这些数字的数字和不能超过m 且要求可选的数字的数目越多越好 输出一种答案即可 解题思路: 刚开始想开一个bool型的1e9的数组,然后判断即可 可是交上去发现内存超限 后来把1e9的数组改成2*1e6的数组即可 具体原因应该从数学数字和方面考虑 具体代码如下: #include<bits/stdc++.h> using…
题目链接 将给出的已经有了的排序, 在前面加上0, 后面加上1e9+1. 然后对相邻的两项判断. 如果相邻两项之间的数的和小于m, 那么全都选上, m减去相应的值. 如果大于m, 那么二分判断最多能选多少个. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include <complex>…
题目链接: C. Tanya and Toys time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered wi…
C. Tanya and Toys 题目链接http://codeforces.com/contest/659/problem/C Description In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collectio…
C. Tanya and Toys 题目连接: http://www.codeforces.com/contest/659/problem/C Description In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new col…
题目链接:http://codeforces.com/problemset/problem/518/B 题目意思:给出字符串 s 和 t,如果 t 中有跟 s 完全相同的字母,数量等于或者多过 s,就将 s 这个数量加到 YAY! 的答案里,少于的话就加 t 中有的数量:如果 t 中有跟 s 相同的字母但是大小写不对应(例如A-a,z-Z),就加到 WHOOPS 的答案里. 举个例子就很容易明白了.例如 s 和 t 分别为: ncMeXssLHS uwyeMcaFatpInZVdEYpwJQSn…
Description In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1to 109. A toy from the new collection of the i-th type costs i bourles. Tania has managed to collect n …
B. Tanya and Postcard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Tanya decided to present her dad a postcard on his Birthday. She has already created a message — string s of le…
Description While dad was at work, a little girl Tanya decided to play with dad characters. She has written all the possible n three-letter continuous substrings of the password on pieces of paper, one for each piece of paper, and threw the password…
题目链接 给你n个长度为3的子串, 这些子串是由一个长度为n+2的串分割得来的, 求原串, 如果给出的不合法, 输出-1. 一个欧拉通路的题, 将子串的前两个字符和后两个字符看成一个点, 比如acb, 就是ac->cb. 然后建图. #include <iostream> #include <vector> #include <cstdio> #include <cstring> #include <algorithm> #include…