当前位置:网站首页>【7.12】Codeforces Round #806 (Div. 4)
【7.12】Codeforces Round #806 (Div. 4)
2022-07-17 18:28:00 【ZhgDgE】
E. Mirror Grid
题意:给定 01 矩阵,一次操作可以置反一个格子。问至少操作多少次使得矩阵旋转任意次都与原来的矩阵相等。
思路:总结了一个旋转的公式:若某点 ( i , j ) (i,j) (i,j) 在 n × n n\times n n×n 的矩阵中旋转 90 ° 90° 90° ,则坐标为 ( j , n − i + 1 ) (j,n-i+1) (j,n−i+1) 。这题注意当 n n n 是奇数时不能枚举多了。
AC代码:https://codeforces.com/contest/1703/submission/163868674
G. Good Key, Bad Key
题意:现有 n n n 个箱子,第 i i i 个箱子里有 a i a_i ai 个金币。你现在要按从 1 1 1 到 n n n 的顺序打开这些箱子。可以用两种钥匙打开箱子,分别是好钥匙和坏钥匙。每次使用好钥匙开箱会花费 k k k 枚金币;每次使用坏钥匙开箱不会花费金币,但会使得包括即将要打开的这个箱子的所有未打开箱子内的金币减半(下取整)。最初,你没有任何金币也没有任何钥匙。在开箱过程中,你可以处于欠债状态。问最多能在开完所有箱子后持有多少金币。
题解:Codeforces Round #806 (Div. 4)
思路:贪心。如果我们选了 x x x 把坏钥匙,那么1分析可得坏钥匙一定是最后且连续使用的。所以枚举好钥匙坏钥匙的边界,更新答案即可。
AC代码:https://codeforces.com/contest/1703/submission/164017522
边栏推荐
- VMware imports ova/ovf virtual machine files
- codeforce:A. Doremy‘s IQ【反向贪心】
- The latest Jilin construction safety officer simulation question bank and answers in 2022
- Solutions to the failure of dedecms dream weaving to save the current column changes
- onvif协议相关:3.1.4 Digest方式获取流地址
- mysql排序索引失效?
- 力扣70-爬楼梯——动态规划
- 【CANN训练营】昇腾AI基础知识介绍
- onvif协议相关:2.1.1 none方式获取token
- A general memory management driver code is sorted out
猜你喜欢

Unveiling secrets of matrixcube 101 - functions and architecture of matrixcube

【js逆向爬虫】-有道翻译js逆向实战

命令行的一些常用操作命令及常见错误的解决办法

565.数组嵌套

力扣413-等差数列划分——动态规划

(pc+wap) dream weaving template clothing dress website

Onvif protocol related: 2.1.2 get screenshot URL in none mode

Module 7 (Architecture Design of King glory mall)

语音通信网络的原理

模块7(王者荣耀商城异地多活架构设计)
随机推荐
动手学深度学习(第二版)注释后代码【持续更新】
Weekly summary (*65): planned output
弘业期货网上开户安全吗?有没有开户指引?
A general memory management driver code is sorted out
名片管理的框架搭建
(pc+wap) dream weaving template clothing dress website
LeetCode 0565. Array nesting: convert to graph + modify in place の optimization
Amino metal organic framework material Fe MOF, fe-mil-88nh2 | Zr based metal organic framework catalyst (pt-uio-66) | Qiyue biology
【码蹄集新手村 600 题】格式化的输入输出,使用 0 来代替补全的空格
onvif協議相關:4.1.3 WS-Username token方式獲取截圖url
[pumpkin Book ml] (task2) mathematical derivation of linear model (least squares estimation, generalized Rayleigh quotient, maximum likelihood estimation, etc.)
onvif协议相关:3.1.2 Digest方式获取token列表
Attachment handling of SAP Fiori
LeetCode 0565.数组嵌套:转换为图 + 原地修改の优化
Is it safe for Everbright futures to open an account online? Are there any account opening guidelines?
jvm自学总结
【码蹄集新手村 600 题】输出时的左对齐,右对齐
Responsive dream weaving template wine cellar website
Responsive Zhimeng template logistics and freight service website
力扣198-213 打家劫舍Ⅰ、Ⅱ——动态规划