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 ...
随机推荐
- ts实战项目启动中遇到的问题
项目链接:https://github.com/Jiasm/typescript-example 储备知识须知: sequelize入门篇 : 依照README执行以下操作: npm i brew s ...
- php分层
表示层 UI 主要表示WEB方式,也可以表示成WINFORM方式.如果逻辑层相当强大和完善,无论表现层如何定义和更改,逻辑层都能完善地提供服务. 业务逻辑层 BLL ...
- Detour的简单使用
Detours的安装:下载部分:1.直接在百度搜"detour",进对应的网站下载.2.或以下链接https://www.microsoft.com/en-us/research/ ...
- VS2012快捷键突然不能用怎么办
晚上做项目做着做着,就去弄了下键盘配置,可怜的娃娃~~~一下子弄得什么快捷键都不能用了,比如”注释:ctrl+k ctrl+c”;问题纠结了我一个多钟,好在最后结合了网络上各路英雄的idea;解决了问 ...
- 数据仓库基础(十二)Informatica组件(2)
本文转载自:http://www.cnblogs.com/evencao/p/3152708.html 1.Router Transformation:在filter 组件中只能写一个过滤条件.而在R ...
- IOS中position:fixed吸底时的滑动出现抖动的解决方案
H5方法: //吸顶头部 .header{ width:100%; height:50px; position:fixed; top:0px; } //main滑动区域 .main{ width:10 ...
- python3.4学习笔记(一) 基本语法 python3不向下兼容,有些语法跟python2.x不一样
python3.4学习笔记(一) 基本语法 python3不向下兼容,有些语法跟python2.x不一样,IDLE shell编辑器,快捷键:ALT+p,上一个历史输入内容,ALT+n 下一个历史输入 ...
- web前端----响应式布局
响应式开发 为什么要进行响应式开发? 随着移动设备的流行,网页设计必须要考虑到移动端的设计.同一个网站为了兼容PC端和移动端显示,就需要进行响应式开发. 什么是响应式? 利用媒体查询,让同一个网站兼容 ...
- cnats 使用
1. 准备 yum install cmakeyum install gcc gcc-c++yum install ncurses ncurses-develyum install openssl o ...
- 20145106《Java程序设计》第7周学习总结
教材学习内容总结 使用Lambda的特性可以去除重复的信息,以取得语法的简洁,增加程序代码的表达性.Lambda表达式本身是中性的,不代表任何类型的实例,同样的Lambda表达式,可用来表示不同目标类 ...