A. Far Relative’s Birthday Cake

题意:

求在同一行、同一列的巧克力对数。

分析:

水题~样例搞明白再下笔!

代码:

#include<iostream>
using namespace std;
const int maxn = 105;
char a[maxn][maxn];
int main (void)
{
int N;cin>>N;
int cnt = 0, res = 0;
for(int i = 0; i < N; i++){
cnt = 0;
for(int j = 0; j < N; j++){
cin>>a[i][j];
if(a[i][j]=='C') cnt++;
}
res += cnt * (cnt - 1)/2;
}
for(int j = 0; j < N; j++){
cnt = 0;
for(int i = 0; i <N; i++){
if(a[i][j]=='C')
cnt++;
}
res += cnt * (cnt - 1)/2;
}
cout<<res<<endl;
return 0;
}

B. Far Relative’s Problem

题意:

给定男生女生的空余时间,求出满足在该天空余的男生数与女生数相等且人数最多的一天。

分析:

白痴的WA了一次。。。直接暴力

代码:

#include<iostream>
#include<cmath>
using namespace std;
const int maxn = 5005, maxm = 400;
int cnt[maxm], flag[maxm];
int main (void)
{
int N;cin>>N;
char a;
int b ,c, l = 400, r = 0;
for(int i = 0; i < N; i++){
cin>>a>>b>>c;
for(int j = b; j <= c; j++){
cnt[j]++;
if(a=='M') flag[j]++;
else flag[j]--;
} }
int res = 0;
for(int i = 1; i <= 366; i++){
if(flag[i]!=0) cnt[i] -= abs(flag[i] - 0);
if(res<cnt[i]) res = cnt[i];
}
cout<<res<<endl;
}

Codeforces Round #343 (Div. 2)【A,B水题】的更多相关文章

  1. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  2. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

  3. Codeforces Round #190 (Div. 2) 水果俩水题

    后天考试,今天做题,我真佩服自己... 这次又只A俩水题... orz各路神犇... 话说这次模拟题挺多... 半个多小时把前面俩水题做完,然后卡C,和往常一样,题目看懂做不出来... A: 算是模拟 ...

  4. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  5. Codeforces Round #340 (Div. 2) B. Chocolate 水题

    B. Chocolate 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co Bob loves everyt ...

  6. Codeforces Round #340 (Div. 2) A. Elephant 水题

    A. Elephant 题目连接: http://www.codeforces.com/contest/617/problem/A Descriptionww.co An elephant decid ...

  7. Codeforces Round #340 (Div. 2) D. Polyline 水题

    D. Polyline 题目连接: http://www.codeforces.com/contest/617/problem/D Descriptionww.co There are three p ...

  8. Codeforces Round #338 (Div. 2) A. Bulbs 水题

    A. Bulbs 题目连接: http://www.codeforces.com/contest/615/problem/A Description Vasya wants to turn on Ch ...

  9. Codeforces Round #282 (Div. 1) A. Treasure 水题

    A. Treasure Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/494/problem/A ...

  10. Codeforces Round #327 (Div. 2) B. Rebranding 水题

    B. Rebranding Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem ...

随机推荐

  1. SSH---整合Struts2&Spring&Hibernate(实例)

    一.SSH回顾 Struts2:核心为过滤器+拦截器.过程:Filter--->FilterDispatcher-->ActionMapper-->ActionProxy--> ...

  2. 直接插入排序法原理及其js实现

    直接插入排序法就像我们打扑克牌时整理牌面一样,先让我们脑补一下我们打牌的过程. 首先摸了一张6, 接着摸到一张4,比6小,插到6的前面: 又摸到一张7,比6大,插到6的后面: 又摸到一张5,比6小,比 ...

  3. 微信小程序之多行文本省略号

    最近在捣鼓小程序,期间遇到的问题,踩过的坑,也是在网上各种搜.这里也说下我解决的问题,方便大家. 在小程序首页显示文本列表的时候,为了美观,不希望把所有的文本都显示出来,希望是显示前几行(比如前3行, ...

  4. 机器学习-Probabilistic interpretation

    Probabilistic interpretation,概率解释  解释为何线性回归的损失函数会选择最小二乘 表示误差,表示unmodeled因素或随机噪声,真实的y和预测出来的值之间是会有误差的, ...

  5. .NET Core MVC Web最最最基础的框架搭建

    1. 使用VS创建.NET Core MVC Web项目 创建完成就是酱紫的了 2. 用NuGet把这些全部都安装了 Install-Package Microsoft.EntityFramework ...

  6. java web 学习笔记 - servlet01

    ---恢复内容开始--- 1.Servlet介绍 Servlet 是用java语言编写的服务器端小程序,属于一个CGI程序,但与传统的CGI不同的是,它是多线程实现的,并且可以多平台移植. 用户自定义 ...

  7. Android(java)学习笔记197:ContentProvider使用之内容观察者02

    下面通过3个应用程序之间的交互说明一下内容观察者: 一. 如下3个应用程序为相互交互的: 二.交互逻辑图: 三.具体代码: 1.   16_数据库工程: (1)数据库帮助类BankDBOpenHelp ...

  8. NET使用SuperSocket完成TCP/IP通信

    1)为什么使用SuperSocket? 性能高,易上手.有中文文档,我们可以有更多的时间用在业务逻辑上,SuperSocket有效的利用自己的协议解决粘包 2)SuperSocket的协议内容? 命令 ...

  9. HDU—4463 Outlets 最小生成树

    In China, foreign brand commodities are often much more expensive than abroad. The main reason is th ...

  10. 使用requests+BeaBeautiful Soup爬取妹子图图片

    1. Requests:让 HTTP 服务人类 Requests 继承了urllib2的所有特性.Requests支持HTTP连接保持和连接池,支持使用cookie保持会话,支持文件上传,支持自动确定 ...