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

链接: 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…
题意:给你一串只含\(4,8,15,16,23,42\)的序列,如果它满足长度是\(6\)的倍数并且有\(\frac {k}{6}\)个子序列是\([4,8,15,16,23,42]\),则定义它是好的,问最少删除多少元素使得序列是好的. 题解:我们开个桶(要离散化)记录这些数字出现的次数,然后线性遍历,当遇到\(4\),我们就直接让它++,否则判断它的前一个数的次数是否大于\(0\),如果是,那么它的前一个数的次数--,它自己次数++,如果前一个数出现的次数为\(0\),那么当前这个数就不能构…
链接: 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…
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), 占用内存太大显然不行.于是想…
传送门 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…
Codeforces Round #467 (div.2) 我才不会打这种比赛呢 (其实本来打算打的) 谁叫它推迟到了\(00:05\) 我爱睡觉 题解 A. Olympiad 翻译 给你若干人的成绩 让你划定一个分数线 使得所有不低于这个分数线的人都可以获奖 但是\(0\)分的人一定不能得奖 问你有多少种获奖情况 题解 \(sort+unique\) 然后判断一下最小值是不是\(0\)就行了 #include<iostream> #include<cstdio> #include…