Codeforces Round #565 (Div. 3) B. Merge it!】的更多相关文章

链接: 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…
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…
链接: 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…
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), 占用内存太大显然不行.于是想…
传送门 A. Divide it! •题意 给定一个数n, 每次可以进行下列一种操作 1.如果n可以被2整除,用n/2代替n 2.如果n可以被3整除,用2n/3代替n 3.如果n可以被5整除,用4n/5代替n 如果可以经过上述操作使得 n 变为 1,输出最小操作次数,反之,输出-1: •思路 n/2 < 2n/3 < 4n/5 要想操作次数最少,优先操作 1 > 2 > 3: •代码 #include<bits/stdc++.h> using namespace std…
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\),那么当前这个数就不能构…
Codeforces Round #446 (Div. 2) 总体:rating涨了好多,虽然有部分是靠和一些大佬(例如redbag和ShichengXiao)交流的--希望下次能自己做出来2333 A. Greed 题意:给你\(n\)个罐子,每个罐子都告诉了你它当前的饮料体积和它的总容积,问能否用两个罐子装下所有饮料(\(n\le 100000\)) 题解:简单模拟即可,用两个最大的算一下,注意累和会爆\(int\) int a[100100], b[100100]; long long s…