Codeforces Round #192 (Div. 2) (330A) A. Cakeminator
题意:
如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕。
//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的更多相关文章
- 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 ...
- Codeforces Round #192 (Div. 2) A. Cakeminator
#include <iostream> #include <vector> using namespace std; int main(){ int r,c; cin > ...
- Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化
C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...
- 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 ...
- Codeforces Round #192 (Div. 1) A. Purification 贪心
A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...
- [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 ...
- Codeforces Round #192 (Div. 2) (330B) B.Road Construction
题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目 ...
- Codeforces Round #192 (Div. 2)
吐槽一下,这次的CF好简单啊. 可是我为什么这么粗心这么大意这么弱.把心沉下来,想想你到底想做什么! A 题意:O(-1) 思路:O(-1) #include <iostream> #in ...
- Codeforces Round #192 (Div. 2) B. Road Construction
#include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin > ...
随机推荐
- laravel扩展包-私有库
创建一个新的laravel项目 composer create-project --prefer-dist laravel/laravel laravel-package "5.5.*&qu ...
- vuex中使用对象展开运算符
使用场景 当需要进行vuex进行数据状态管理的时候,会使用到mapGetters,mapState,还有自身的计算属性的时候,这个时候就会用到这个了! 1.首先需要安装 npm install bab ...
- Java:HashMap原理与设计缘由
前言 Java中使用最多的数据结构基本就是ArrayList和HashMap,HashMap的原理也常常出现在各种面试题中,本文就HashMap的设计与设计缘由作出一一讲解,并解答面试常见的一些问题. ...
- kuberbetes基础概念
部署了一大堆,来了解一下K8S一些基本的概念. 1.Node Node作为集群中的工作节点,运行真正的应用程序,在Node上Kubernetes管理的最小运行单元是Pod.Node上运行着Kubern ...
- centos7搭建基于SAMBA的网络存储
学习目标: 通过本实验理解Linux系统下SAMBA服务器和客户端的配置,实现客户机可自动挂载服务端的共享存储. 操作步骤: 1. SAMBA服务器搭建 2. SAMBA客户端配置 参考命令: ...
- MapReduce in MongoDB
MongoDB の MapReduce 在Hadoop的学习中已经接触过MapReduce了,它是一个很成熟的计算模型,将大批量的工作(也就是数据)分解(MAP映射)执行,最后将结果合并成最终的Red ...
- !干货! 为设计指定输入驱动强度 set_driving_cell set_drive set_input_transition
!干货! 为设计指定输入驱动强度 set_driving_cell set_drive set_input_transition 本文转自:自己的微信公众号<集成电路设计及EDA教程> 里 ...
- Mysql CPU使用率长期100%的解决思路备忘
最近一台服务器的CPU使用率长期保持在100%的状态,查看进程发现是Mysql服务导致的.于是搜索各方资料,终于成功解决问题.备忘以及分享一下,希望可以帮助各位新手朋友. (服务器运行环境是Windo ...
- MyBatis从入门到精通:update用法、delete用法
update用法: 1.接口类中添加的方法: int updateById(SysUser sysUser); 2.映射文件中添加的代码: <update id="updateById ...
- 洛谷P1690 贪婪的Copy 题解
题目:https://www.luogu.org/problemnew/show/P1690 分析: 这道题就是一道最短路的题目,因为看到数据范围: n≤100n\leq100n≤100 所以考虑使用 ...