找规律/贪心 Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones
/*
找规律/贪心:ans = n - 01匹配的总数,水
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; const int MAXN = 2e5 + ;
const int INF = 0x3f3f3f3f;
char s[MAXN]; int main(void) //Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones
{
// freopen ("A.in", "r", stdin); int n;
while (scanf ("%d", &n) == )
{
scanf ("%s", s);
int cnt_0 = , cnt_1 = ;
for (int i=; i<n; ++i)
{
if (s[i] == '') cnt_0++;
else cnt_1++;
} printf ("%d\n", n - min (cnt_0, cnt_1) * );
} return ;
}
找规律/贪心 Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones的更多相关文章
- Codeforces Round #310 (Div. 2) A. Case of the Zeros and Ones 水题
A. Case of the Zeros and Ones Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/con ...
- 贪心/思维题 Codeforces Round #310 (Div. 2) C. Case of Matryoshkas
题目传送门 /* 题意:套娃娃,可以套一个单独的娃娃,或者把最后面的娃娃取出,最后使得0-1-2-...-(n-1),问最少要几步 贪心/思维题:娃娃的状态:取出+套上(2),套上(1), 已套上(0 ...
- 构造 Codeforces Round #310 (Div. 2) B. Case of Fake Numbers
题目传送门 /* 题意:n个数字转盘,刚开始每个转盘指向一个数字(0~n-1,逆时针排序),然后每一次转动,奇数的+1,偶数的-1,问多少次使第i个数字转盘指向i-1 构造:先求出使第1个指向0要多少 ...
- 数学/找规律/暴力 Codeforces Round #306 (Div. 2) C. Divisibility by Eight
题目传送门 /* 数学/暴力:只要一个数的最后三位能被8整除,那么它就是答案:用到sprintf把数字转移成字符读入 */ #include <cstdio> #include <a ...
- 【找规律】Codeforces Round #392 (Div. 2) C. Unfair Poll
C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #310 (Div. 1) B. Case of Fugitive set
B. Case of Fugitive Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/p ...
- Codeforces Round #310 (Div. 1) C. Case of Chocolate set
C. Case of Chocolate Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/555/ ...
- Codeforces Round #310 (Div. 2) B. Case of Fake Numbers 水题
B. Case of Fake Numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...
- Codeforces Round #310 (Div. 1) A. Case of Matryoshkas 水题
C. String Manipulation 1.0 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contes ...
随机推荐
- N+6 裁员裁出幸福感的背后
01. 史上最牛逼的数据库公司,Oracle 裁员了. 2019年5月7日,甲骨文召开了面向全中国区的电话会议,亚太区人力资源负责人在会上简要介绍道,公司正进行业务结构调整,导致一部分人要离开岗位,这 ...
- Meteor跟踪器(Tracker)
跟踪器是用于当模板会话变量发生了变化自动更新的一个小型库. 为了向你展示跟踪器是如何工作的,我们将创建按钮将用于更新会话. meteorApp/import/ui/meteorApp.html < ...
- 《Spring设计思想》AOP设计基本原理
0.前言 Spring 提供了AOP(Aspect Oriented Programming) 的支持, 那么,什么是AOP呢?本文将通过一个另外一个角度来诠释AOP的概念,帮助你更好地理解和使用Sp ...
- HDU 5285 wyh2000 and pupil(dfs或种类并查集)
wyh2000 and pupil Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Other ...
- js实现的美女瀑布流效果代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...
- 2014ACM/ICPC亚洲区域赛牡丹江站现场赛-I ( ZOJ 3827 ) Information Entropy
Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Information ...
- EXTJS 4 树形表格组件使用演示样例
EXTJS 4 树形表格组件使用演示样例 一.总体效果图 version=1&modificationDate=1412058826000&api=v2" alt=" ...
- mysql最新版中文参考手册在线浏览
MySQL是最流行的开放源码SQL数据库管理系统,具有快速.可靠和易于使用的特点.同时MySQL也是一种关联数据库管理系统,具有很高的响应速度和灵活性.又因为mysql拥有良好的连通性.速度和安全性, ...
- 图像处理之基础---opencv 开发的环境搭建
vs2010 opencv2.4.8 下载: vs2010 http://opencv.org/ 步骤: http://my.phirobot.com/blog/2014-02-opencv_conf ...
- android各种菜单使用介绍
Android菜单的有这几种: 1,OptionMenue:选项菜单 2,contextMenu:上下文菜单 3,SubMenu子菜单 其中,OptionMenue与contextMenu的区别(Op ...