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< ...
随机推荐
- 14-3 SQL Server基本操作
SQL Server安装默认新建四个系统数据库 1.master数据库 Master数据库时SQL Server中最重要的数据库.它记录SQL Server实例的所有系统级信息,包括实例范围的元数据. ...
- js 简单的滑动1
js 简单的滑动教程(一) 作者:Lellansin 转载请标明出处,谢谢 首先我们要实现一个简单的滑动,三张图.点击左边向左滑动,点右向右滑,碰到临界值的时候就不能滑动. 这个简单滑动的原理是, ...
- Java对list进行分页,subList()方法实现分页
/** * 自定义List分页工具 * @author hanwl */ public class PageUtil { /** * 开始分页 * @param list * @param pageN ...
- 【POJ3613 Cow Relays】(广义矩阵乘法)
题目链接 先离散化,假设有\(P\)个点 定义矩阵\(A_{ij}\)表示\(i\)到\(j\)只经过一条边的最短路,\[{(A^{a+b})_{ij}=\min_{1\le k\le p} \{ ( ...
- ToLua Timer机制
从一个Bug说起: 在内部试玩时发现有个任务的玩家跟随Npc逻辑挂了. telnet连接到出问题的设备上, 开始搞事情 这个跟随的逻辑是一个Timer驱动的. 这个Timer在主角创建时就会启动. 一 ...
- JS权威指南读书笔记(五)
第十三章 Web浏览器中的JavaScript 1 在Html文档中嵌入客户端4种JS代码方法 a 内联方式,放置在<script>标签之间 b 放置在<script ...
- HTML—链接
怎么看都觉得链接太神奇了,尤其是创建电子邮件的链接,于是决定单独写一篇关于HTML链接的内容,同时加深记忆 一.首先,超链接可以是一个字,一个词,或者一组词,也可以是一幅图像,通过点击这些内容来跳转到 ...
- Tomcat - 控制台乱码
1.找到${CATALINA_HOME}/conf/logging.properties 2.找到java.util.logging.ConsoleHandler.encoding = UTF-8 修 ...
- oracle rpad()和lpad()函数
函数参数:rpad( string1, padded_length, [ pad_string ] ) rpad函数从右边对字符串使用指定的字符进行填充 string 表示:被填充的字符串 padde ...
- 【转】如何使用jupyter编写数学公式(译)
[1.如何使用jupyter编写数学公式(译)][1] [1]: https://www.jianshu.com/p/93ccc63e5a1b