D. Recover it! Authors guessed an array aa consisting of nn integers; each integer is not less than 22 and not greater than 2⋅1052⋅105. You don't know the array aa, but you know the array bb which is formed from it with the following sequence of oper…
题意:给你一串只含\(4,8,15,16,23,42\)的序列,如果它满足长度是\(6\)的倍数并且有\(\frac {k}{6}\)个子序列是\([4,8,15,16,23,42]\),则定义它是好的,问最少删除多少元素使得序列是好的. 题解:我们开个桶(要离散化)记录这些数字出现的次数,然后线性遍历,当遇到\(4\),我们就直接让它++,否则判断它的前一个数的次数是否大于\(0\),如果是,那么它的前一个数的次数--,它自己次数++,如果前一个数出现的次数为\(0\),那么当前这个数就不能构…
D. Tanya and Password Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/508/problem/D Description While dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a stri…
传送门 题目 \[ \begin{aligned} &f_n=c^{2*n-6}f_{n-1}f_{n-2}f_{n-3}&\\ \end{aligned} \] 思路 我们通过迭代发现\(f_n\)其实就是由\(c^{t_1},f_1^{t_2},f_2^{t_3},f_3^{t_4}\)相乘得到,因此我们可以分别用矩阵快速幂求出\(t_1,t_2,t_3,t_4\),最后用快速幂求得答案. 对于\(n<=3\)的我们直接输出即可,\(n>3\)的我们先将\(n\)减去\(3…
链接: https://codeforces.com/contest/1176/problem/B 题意: You are given an array a consisting of n integers a1,a2,-,an. In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter whe…
链接: https://codeforces.com/contest/1176/problem/A 题意: You are given an integer n. You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace n with n2 if n is divisible by 2; Replace n with…
链接: https://codeforces.com/contest/1176/problem/C 题意: You are given an array a consisting of n integers. Each ai is one of the six following numbers: 4,8,15,16,23,42. Your task is to remove the minimum number of elements to make this array good. An a…
B. Merge it! 题目链接:http://codeforces.com/contest/1176/problem/B 题目 You are given an array a consisting of n integers a1,a2,…,an In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not…
A. Divide it! 题目链接:http://codeforces.com/contest/1176/problem/A 题目 You are given an integer n You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace n with n2 if n is divisible by 2;Rep…
题目地址:http://codeforces.com/contest/1176/problem/F 思路:其实就是一个01背包问题,只是添加了回合和每回合的01限制,和每当已用牌数到了10的倍数,那张卡会触发double攻击. 因为卡使用的多少会触发double效果,所以我们要记录攻击的同时记录卡的使用次数,可以由01背包dp[N][N]改变, 第一个维度是当前是第几个回合,第二个维度是记录卡在用了n张的情况下造成的攻击力,但是dp[N][N](N <= 2e5), 占用内存太大显然不行.于是想…