题意:

如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕。

//cf 192 div2
#include <stdio.h>
#include <string.h> int vis[11][11];
char map[11][11]; int main()
{
int r, c;
while (scanf("%d %d", &r, &c) != EOF)
{
for (int i = 1; i <= r; i++)
scanf("%s", &map[i][1]);
memset(vis, 0, sizeof (vis));
for (int i = 1; i <= r; i++)
{
int flag = 1;
for (int j = 1; j <= c; j++)
{
if (map[i][j] == 'S')
{
flag = 0;
break;
}
}
if (flag)
{
for (int j = 1; j <= c; j++)
vis[i][j] = 1;
}
}
for (int i = 1; i <= c; i++)
{
int flag = 1;
for (int j = 1; j <= r; j++)
{
if (map[j][i] == 'S')
{
flag = 0;
break;
}
}
if (flag)
{
for (int j = 1; j <= r; j++)
vis[j][i] = 1;
}
}
int sum = 0;
for (int i = 1; i <= r; i++)
{
for (int j = 1; j <= c; j++)
{
if (vis[i][j] == 1)
sum++;
}
}
printf("%d\n", sum);
}
return 0;
}

Codeforces Round #192 (Div. 2) (330A) A. Cakeminator的更多相关文章

  1. Codeforces Round #192 (Div. 2) A. Cakeminator【二维字符数组/吃掉cake,并且是一行或者一列下去,但是该行/列必须没有草莓的存在】

    A. Cakeminator time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  2. Codeforces Round #192 (Div. 2) A. Cakeminator

    #include <iostream> #include <vector> using namespace std; int main(){ int r,c; cin > ...

  3. Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化

    C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...

  4. Codeforces Round #192 (Div. 1) B. Biridian Forest 暴力bfs

    B. Biridian Forest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/pr ...

  5. Codeforces Round #192 (Div. 1) A. Purification 贪心

    A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...

  6. [Codeforces Round #192 (Div. 2)] D. Biridian Forest

    D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #192 (Div. 2) (330B) B.Road Construction

    题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目 ...

  8. Codeforces Round #192 (Div. 2)

    吐槽一下,这次的CF好简单啊. 可是我为什么这么粗心这么大意这么弱.把心沉下来,想想你到底想做什么! A 题意:O(-1) 思路:O(-1) #include <iostream> #in ...

  9. Codeforces Round #192 (Div. 2) B. Road Construction

    #include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin > ...

随机推荐

  1. Mysql事务隔离级别和锁机制

    一.Spring支持四种事务隔离级别: 1.ISOLATION_READ_UNCOMMITTED(读未提交):这是事务最低的隔离级别,它充许令外一个事务可以看到这个事务未提交的数据. 2.ISOLAT ...

  2. Java学习笔记——设计模式之六.原型模式(浅克隆和深克隆)

    That there's some good in this world, Mr. Frodo. And it's worth fighting for. 原型模式(prototype),用原型实例指 ...

  3. Vue SSR初探

    因为之前用nuxt开发过应用程序,但是nuxt早就达到了开箱即用的目的,所以一直对vue ssr的具体实现存在好奇. 构建步骤 我们通过上图可以看到,vue ssr 也是离不开 webpack 的打包 ...

  4. 记一次SQL优化。

    程序是数据库的用户,为打造良好的用户体验,我们一直在努力. 此次介绍一个基于SQL的数据库优化.SQL的优劣对数据库的性能影响非常关键. 查询只涉及如下表结构中的三个字段.如下 开发原始SQL SEL ...

  5. HDU 1828:Picture(扫描线+线段树 矩形周长并)

    题目链接 题意 给出n个矩形,求周长并. 思路 学了区间并,比较容易想到周长并. 我是对x方向和y方向分别做两次扫描线.应该记录一个pre变量,记录上一次扫描的时候的长度,对于每次遇到扫描线统计答案的 ...

  6. 2019-2020年值得关注的9个AR发展趋势

    作者Andrew Makarov,由计算机视觉life编辑:乔媛媛编译 更好的阅读体验请看首发原文链接 2019-2020年值得关注的9个AR发展趋势 增强现实技术在2019年实现了创纪录的发展.微软 ...

  7. SQL Server Update 链接修改和when的应用

    一.自链接方式 update b1 set b1.money = b1.money + b2.money from (select * from wallet where type='余额') b1 ...

  8. Elasticsearch实战总结

    上手elasticsearch有段时间了,主要以应用为主,未做深入的研究,下面就简单的日常作个简单的总结,做个记录. 版本问题 es版本繁杂,让首次使用的人无从下手.常见的有2+.5+版本,最新版已达 ...

  9. 腾讯云tomcat问题

    Ubuntu启动特别慢 1.在$JAVA_HOME/jre/lib/security/java.security中,把securerandom.source=file:/dev/urandom替换成s ...

  10. [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]列名 'user1' 无效

    唉,还是自己对php执行sql语句运用不熟练.... 我的错误代码是这样的,(解决办法在最后) $re=sqlsrv_query($conn, "select * from visitor ...