Educational Codeforces Round 68 (Rated for Div. 2)---B
http://codeforces.com/contest/1194/problem/B
/* */
# include <bits/stdc++.h>
using namespace std; int r[], c[];
string s[]; int main()
{
int n, m, q;
scanf("%d", &q);
while( q-- )
{
scanf("%d %d", &n, &m);
for(int i=; i<n; i++ )
cin>>s[i];
int cnt = ;
for( int i=; i<n; i++ )
{
cnt=;
for( int j=; j<m; j++ )
{
if( s[i][j]=='.' )
cnt++;
}
r[i] = cnt;
}
for( int j=; j<m; j++ )
{
cnt = ;
for( int i=; i<n; i++ )
{
if( s[i][j]=='.' )
cnt++;
}
c[j] = cnt;
}
int ans = ;
for( int i=; i<n; i++ )
{
for(int j=; j<m; j++ )
{
int temp = r[i]+c[j];
if( s[i][j]=='.' )
temp--;
ans = min(ans, temp);
}
}
printf("%d\n", ans);
}
return ;
}
Educational Codeforces Round 68 (Rated for Div. 2)---B的更多相关文章
- Educational Codeforces Round 68 (Rated for Div. 2)补题
A. Remove a Progression 签到题,易知删去的为奇数,剩下的是正偶数数列. #include<iostream> using namespace std; int T; ...
- Educational Codeforces Round 68 (Rated for Div. 2) C. From S To T (字符串处理)
C. From S To T time limit per test1 second memory limit per test256 megabytes inputstandard input ou ...
- Educational Codeforces Round 68 (Rated for Div. 2) D. 1-2-K Game (博弈, sg函数,规律)
D. 1-2-K Game time limit per test2 seconds memory limit per test256 megabytes inputstandard input ou ...
- Educational Codeforces Round 68 (Rated for Div. 2)D(SG函数打表,找规律)
#include<bits/stdc++.h>using namespace std;int sg[1007];int main(){ int t; cin>>t; while ...
- Educational Codeforces Round 68 (Rated for Div. 2)-D. 1-2-K Game
output standard output Alice and Bob play a game. There is a paper strip which is divided into n + 1 ...
- Educational Codeforces Round 68 (Rated for Div. 2)-C-From S To T
You are given three strings ss, tt and pp consisting of lowercase Latin letters. You may perform any ...
- Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...
- Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...
- Educational Codeforces Round 43 (Rated for Div. 2)
Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...
随机推荐
- ADO.NET 一(概述)
在 C# 语言中 ADO.NET 是在 ADO 的基础上发展起来的,ADO (Active Data Object) 是一个 COM 组件类库,用于访问数据库,而 ADO.NET 是在 .NET 平台 ...
- 1+X证书学习日志——定位
## 静态定位: position:static; 默认值,指定left/right/top/bottom/ 没有作用. pos ...
- windows下git创建本地分支并建立对应远程分支
在对应项目目录下打开命令提示符 git branch -a 查看所有本地和远程分支 git checkout -b [newBranch] 建立本地分支newBranch git p ...
- AndroidStudio中Run按钮是灰色的解决方法
在model下拉框中选择app.如果下拉框中没有app,(没有工程名),那么请先去设置: Android Studio 3.3.0 File->sync project with gradles ...
- java web编程 servlet2
一般在开发的过程中主要用一个doGet和doPost方法, http就是超文本传输协议,这是java API对servlet的描述 : 一般我们调用的方法细则如下 : service一分为二reque ...
- python 版本号比较 重载运算符
# -*- coding: utf-8 -*- class VersionNum(object): """ 版本号比较 默认版本以“.”分割,各位版本位数不超过3 例一: ...
- MySQL Backup--Xtrabackup备份设置锁等待问题
问题描述 innobackupex备份过程需要保证备份数据一致性,通过刷新表缓存和加全局读锁(FLUSH TABLES WITH READ LOCK)获取备份位点,而为防止锁等待超时,会先设置: SE ...
- [ipsec][strongswan] strongswan源码分析-- (三) xfrm与strongswan内核接口分析
目录 strongwan sa分析(三) xfrm与strongswan内核接口分析 1. strongswan的实现 2. 交互机制 4. xfrm的消息通信的实现 strongwan sa分析(三 ...
- 使用fail2ban预防被挖洞的笔记
参考:https://blog.csdn.net/dorisnzy/article/details/82926067 1.安装fail2ban: yum -y install epel-release ...
- APS实现的要点与难点
在前一篇关于文章中讨论了不同层级.粒度的生产计划,在各行业中受重视程度的差异问题. 承蒙大家热烈讨论.本文则在收集各方高见的基础上,对于供应链上各个环节的运营.生产计划再作稍微深入一点的探讨.本文将列 ...