Problem 330A - Cakeminator (思维)
330A. Cakeminator
https://codeforces.com/problemset/problem/330/A
题意很容易理解:给定一块蛋糕区域,但蛋糕上有几个不能吃的草莓,大胃王一次能吃一整列、行
求在不吃到草莓的情况下能迟到的最多的蛋糕数
//cpp
#include<bits/stdc++.h>
using namespace std;
int main() {
//freopen("in.txt", "r", stdin);
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int n, m; set<int>a, b; char c;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= m; ++j) { cin >> c; if (c == 'S') a.insert(i), b.insert(j); }
cout << m * n - a.size() * b.size();
}
#python
S=input
n,m=map(int,S().split())
g=[S() for i in range(n)]
print(n*m-len([1 for i in g if i.count('S')])*len([1 for i in zip(*g) if i.count('S')]))
Problem 330A - Cakeminator (思维)的更多相关文章
- FZU Problem 2214 Knapsack problem(背包+思维转换)
转化思维,把价值当成背包容量,选择最小的花费,从上到下枚举,找到当这个最小的花费. #include<iostream> #include<cstring> #include& ...
- codeforces 798 C. Mike and gcd problem(贪心+思维+数论)
题目链接:http://codeforces.com/contest/798/problem/C 题意:给出一串数字,问如果这串数字的gcd大于1,如果不是那么有这样的操作,删除ai, ai + 1 ...
- zoj 2818 Root of the Problem(数学思维题)
题目链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 题目描述: Given positive integer ...
- (P2022 有趣的数)||(zoj Little Sub and Mr.Potato's Math Problem)(思维)
题目链接:https://www.luogu.org/problemnew/show/P2022 题目大意:中文题目 具体思路: 第一步:我们可以先计算出当前的数前面按照字典序的话,前面有多少数(包括 ...
- HDU 1029 Ignatius and the Princess IV / HYSBZ(BZOJ) 2456 mode(思维题,~~排序?~~)
HDU 1029 Ignatius and the Princess IV (思维题,排序?) Description "OK, you are not too bad, em... But ...
- Codeforces Round #546 (Div. 2) D 贪心 + 思维
https://codeforces.com/contest/1136/problem/D 贪心 + 思维 题意 你面前有一个队列,加上你有n个人(n<=3e5),有m(m<=个交换法则, ...
- poj 1789 Truck History(kruskal算法)
主题链接:http://poj.org/problem?id=1789 思维:一个一个点,每两行之间不懂得字符个数就看做是权值.然后用kruskal算法计算出最小生成树 我写了两个代码一个是用优先队列 ...
- C. Alyona and mex
http://codeforces.com/contest/740/problem/C 构造思维题. 第一直觉就是区间长度+1的最小值就是答案. 然而不知道怎么去构造这个序列. 其实就是每个区间,都要 ...
- Codeforces Round #767 (Div. 2) c d, 巧妙标记
贪心: Problem - C - Codeforces 思维: Problem - D - Codeforces 这两个题不错, 第一个需要考虑后面,就先标记完, 从前遍历挨个除去标记 第二个需要考 ...
- FOJProblem 2214 Knapsack problem(01背包+变性思维)
http://acm.fzu.edu.cn/problem.php?pid=2214 Accept: 4 Submit: 6Time Limit: 3000 mSec Memory Lim ...
随机推荐
- 提升效率,打通万里牛ERP与下游用友U8财务软件的无缝对接
一.对接流程 1.1 销售/售后流程 在万里牛订单出库后,通过轻易云数据集成平台将数据推送至用友U8销售订单和销售出库单,这些单据可以进行关联操作. 当万里牛售后单完成退货入库后,通过数据集成平台将数 ...
- Android学习day01【搭建Android Studio】
是Google开发的操作系统 Android开发是移动应用开发的表现形式之一 还有很多的开发形式,就不一一列举了 完整项目精简的开发流程 开发工具 Android studio(强烈建议) Andro ...
- 【GKCTF 2020】ez三剑客
[GKCTF 2020]ez三剑客 收获 gopher协议SSRF 多利用github搜索已存在的函数漏洞 CMS审计的一些方法 1. ezweb 打开题目给了一个输入框,能够向输入的url发送htt ...
- python中的post请求
用python来验证接口正确性,主要流程有4步: 1 设置url 2 设置消息头 3 设置消息体 4 获取响应 5 解析相应 6 验证数据 Content-Type的格式有四种:分别是applicat ...
- Pattern类和Matcher类的使用
1.先看好数据源 先将一个String对象确定为程序要对其进行操作的数据源. String b="hello,good morning"; 2.建立Pattern类的对象 Stri ...
- [ABC282F] Union of Two Sets
Problem Statement This is an interactive task, where your and the judge's programs interact via Stan ...
- Netty源码学习9——从Timer到ScheduledThreadPoolExecutor到HashedWheelTimer
系列文章目录和关于我 一丶前言 之前在学习netty源码的时候,经常看netty hash时间轮(HashedWheelTimer)的出现,时间轮作为一种定时调度机制,在jdk中还存在Timer和Sc ...
- mac如何访问同一wifi下的项目-mac-ru-he-fang-wen-tong-yi-wifi-xia-de-xiang-mu
title: mac如何访问同一wifi下的项目 date: 2022-03-28 20:14:06.341 updated: 2022-03-28 21:55:42.53 url: https:// ...
- thymeleaf自定义标签
前言 使用thymeleaf自定义标签,环境:springboot 2.3.7 + thymeleaf 3.0.11(2021-01-14最新版) 由于使用shiro,我们需要与thymeleaf整合 ...
- Shiro 的基本使用
简介 Apache Shiro 是一个强大的.灵活的开源安全框架,可以干净地处理验证.授权.企业会话管理和加密等功能 相关特性 Apache Shiro 具有的主要特性如下图所示: 主要关注的地方在于 ...