SUM_ACM-Codeforces Round 941 (Div. 2)
- A
Card Exchange
https://codeforces.com/contest/1966/problem/A
思路:找规律,如果b>a,输出a,如果a中有大于等于b个数,输出b-1即可,如果a中小于b个数输出a。
点击查看代码
#include <bits/stdc++.h>
using namespace std;
int v[101];
int main (){
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n;
cin>>n;
while(n--){
memset(v,0,sizeof v);
int res=0;
int a,b;
cin>>a>>b;
for(int i=1;i<=a;i++){
int c;
cin>>c;
v[c]++;
res=max(res,v[c]);
}
if(a<b){
cout<<a<<endl;
}else
{
if(res<b)
cout<<a<<endl;
else
cout<<b-1<<endl;
}
}
}
- B
Rectangle Filling
https://codeforces.com/contest/1966/problem/B
思路:找出不可能的条件为:最上层和最下层不同输出为NO(这里最上层和最下层中的所有元素相同)。
代码如下:
点击查看代码
#include <bits/stdc++.h>
using namespace std;
char mp[502][502];
int main (){
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n;
cin>>n;
while(n--){
memset(mp,0,sizeof mp);
int pd1=0;
int pd11=0;
int pd00=0;
int pd0=0;
int pd33=0;
int pd3=0;
int pd4=0;
int pd44=0;
int a,b;
cin>>a>>b;
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
cin>>mp[i][j];
}
}
for(int j=1;j<=b;j++)
{
if(mp[1][j]=='B')
pd0++;
}
for(int j=1;j<=b;j++)
{
if(mp[1][j]=='W')
pd1++;
}
for(int j=1;j<=b;j++)
{
if(mp[a][j]=='B')
pd00++;
}
for(int j=1;j<=b;j++)
{
if(mp[a][j]=='W')
pd11++;
}
for(int j=1;j<=a;j++)
{
if(mp[j][1]=='B')
pd3++;
}
for(int j=1;j<=a;j++)
{
if(mp[j][1]=='W')
pd4++;
}
for(int j=1;j<=a;j++)
{
if(mp[j][b]=='B')
pd33++;
}
for(int j=1;j<=a;j++)
{
if(mp[j][b]=='W')
pd44++;
}
if((pd1==b&&pd00==b)||(pd0==b&&pd11==b)||(pd3==a&&pd44==a)||(pd4==a&&pd33==a))
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
}
SUM_ACM-Codeforces Round 941 (Div. 2)的更多相关文章
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
- Codeforces Round #262 (Div. 2) 1003
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...
- Codeforces Round #262 (Div. 2) 1004
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...
- Codeforces Round #371 (Div. 1)
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...
- Codeforces Round #268 (Div. 2) ABCD
CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
随机推荐
- 深入理解 Swoole 的底层加载原理
首发原文链接:深入理解 Swoole 的底层加载原理 PHP 扩展加载 我们从 php-src/sapi/cli/php_cli.c:1159 文件的入口函数 int main(int argc, c ...
- 使用爬虫利器 Playwright,轻松爬取抖查查数据
使用爬虫利器 Playwright,轻松爬取抖查查数据 我们先分析登录的接口,其中 url 有一些非业务参数:ts.he.sign.secret. 然后根据这些参数作为关键词,定位到相关的 js 代码 ...
- sourceTree .gitignore文件处理
最近犯了个低级错误,在sourceTree中通过右键,直接将 工程文件加入到 ignore列表中.提交之后,别人拉下来代码一直显示报错 在意识到上面这个错误之后,一直想恢复却恢复不了,尝试从Sorce ...
- iOS 处理HLS视频流
一.HLS介绍 HLS是苹果主导的音视频传输协议,其主要的格式是一个索引文件(M3U8)+ ts分片的视频文件. HLS的优势是iOS系统天然支持,通过Http 80传输,规避了常规的防火墙问题. 视 ...
- Aqua 专为自动化测试打造的IDE
JetBrains是一家全球知名的软件开发公司,他们公司推出的IDE几乎是编程语言的首选,IntelliJ IDEA 之于Java,PyCharm之于Python,以及GoLand之于go等. 5月2 ...
- k8s数据持久化
前面的学习,我们已经基本完成了在k8s中部署一个web服务,运行pod.创建service.创建ingress对外提供域名的七层代理. 下一个环境就得去关注应用部署后的数据存储问题,容器化如何管理,k ...
- Promise 期约
Promise 期约之前 回调地狱 设想这样一个经常发生的场景,我们希望处理Ajax请求的结果,所以我们将处理请求结果的方法作为回调传入,需要将请求结果继续处理,这就导致我们陷入了回调地狱 doSom ...
- nordic的nrf52系列——ADC在使用时如何校准增益误差(基于SDK)
简介:ADC在实际使用的时候都要进行误差校准,那Nordic的nrf52系列如何进行校准,如果不校准又有什么影响尼,接下来我将通过实验进行测试,验证不校准和校准的影响(本测试的基础是,默认输入阻抗和采 ...
- 燕千云 YQCloud 数智化业务服务管理平台 发布1.13版本
2022年6月10日,燕千云 YQCloud 数智化业务服务管理平台发布1.13版本.本次燕千云1.13版本新增了远程桌面.知识库多人在线协作.移动端疫苗核酸信息管理.单据委托代理.技能管理.产品自助 ...
- Task - lmdeploy
基础作业: 使用 LMDeploy 以本地对话.网页Gradio.API服务中的一种方式部署 InternLM-Chat-7B 模型,生成 300 字的小故事(需截图