Codeforces 525A - Vitaliy and Pie
思路:贪心+hashing。
代码:
#include<bits/stdc++.h>
using namespace std;
string s;
int Hash[]={};
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n,ans=;
cin>>n>>s;
for(int i=;i<s.size();i++)
{
if(islower(s[i]))
{
Hash[s[i]-'a']++;
}
else
{
if(Hash[s[i]-'A'])Hash[s[i]-'A']--;
else ans++;
}
}
cout<<ans<<endl;
return ;
}
Codeforces 525A - Vitaliy and Pie的更多相关文章
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie
题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...
- Vitaliy and Pie(模拟)
Vitaliy and Pie Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Su ...
- cf- 297 < a >--字符串操作技巧
A. Vitaliy and Pie time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Beta Round #51 C. Pie or die 博弈论找规律 有趣的题~
C. Pie or die Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55/problem/ ...
- CodeForces - 55C Pie or die 想法题(猜程序)
http://codeforces.com/problemset/problem/55/C 题意:一个博弈. 题解:瞎猜,目前不清楚原理 #include<iostream> #inclu ...
- Codeforces 859C - Pie Rules
859C - Pie Rules 思路: dp 我们知道无论谁拿到decider token他拿不拿蛋糕都是确定的,都是使自己最优的结果. 于是 定义状态:dp[i]表示到第i个位置拿到decider ...
- Codeforces Round#413 Div.2
A. Carrot Cakes 题面 In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, al ...
- CF55C. Pie or die
/* CF55C. Pie or die http://codeforces.com/problemset/problem/55/C 博弈论 乱搞 获胜条件是存在一个棋子到边界的值小于5 */ #in ...
随机推荐
- Lower Power with CPF(三)
常用的一些Lower Power的策略: 1)Clock tree optimization and clock gating:在正常情况下clock信号会一直toggle at the maximu ...
- 持续集成之三:Linux安装Jenkins
环境 Red Hat Enterprise Linux Server release 7.3 (Maipo) jdk1.7.0_80 apache-tomcat-7.0.90 jenkin ...
- Python: TypeError: 'dict' object is not callable
问题: TypeError: 'dict' object is not callable 原因: dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...
- Oracle 启动的时候需要的服务
- MongoDB ----基于分布式文件存储的数据库
参考: http://www.cnblogs.com/huangxincheng/category/355399.html http://www.cnblogs.com/daizhj/category ...
- cursor图标自定义
cursor: url(./images/favicon.ico), auto; 首先auto必须加上,其次必须使用ico文件,目前来说ico文件没有兼容性问题,ico格式怎么转? 传送门:http: ...
- Django框架介绍之cookie与session
cookie http请求时无状态的,一个客户端第一次,第二次,第n次访问同一个服务器都是一样的,服务器都会按照一个新的连接处理.但是,有时候客户端需要服务器记住客户端的登录状态,譬如离开一会,回来之 ...
- STM32.BOOT
BOOT0 和 BOOT1STM32 三种启动模式对应的存储介质均是芯片内置的,它们是:1)用户闪存 = 芯片内置的?Flash.2)SRAM = 芯片内置的 RAM 区,就是内存啦.3)系统存储器 ...
- 利用RNN(lstm)生成文本【转】
本文转载自:https://www.jianshu.com/p/1a4f7f5b05ae 致谢以及参考 最近在做序列化标注项目,试着理解rnn的设计结构以及tensorflow中的具体实现方法.在知乎 ...
- uboot启动提示Error, wrong i2c adapter 0 max 0 possible后卡住了怎么办
答:这个与i2c驱动有关,应该使能i2c驱动相关的配置项