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的更多相关文章

  1. 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  ...

  2. 模拟 Codeforces Round #297 (Div. 2) A. Vitaliy and Pie

    题目传送门 /* 模拟:这就是一道模拟水题,看到标签是贪心,还以为错了呢 题目倒是很长:) */ #include <cstdio> #include <algorithm> ...

  3. Vitaliy and Pie(模拟)

    Vitaliy and Pie Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Su ...

  4. cf- 297 < a >--字符串操作技巧

    A. Vitaliy and Pie time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. 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/ ...

  6. CodeForces - 55C Pie or die 想法题(猜程序)

    http://codeforces.com/problemset/problem/55/C 题意:一个博弈. 题解:瞎猜,目前不清楚原理 #include<iostream> #inclu ...

  7. Codeforces 859C - Pie Rules

    859C - Pie Rules 思路: dp 我们知道无论谁拿到decider token他拿不拿蛋糕都是确定的,都是使自己最优的结果. 于是 定义状态:dp[i]表示到第i个位置拿到decider ...

  8. 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 ...

  9. CF55C. Pie or die

    /* CF55C. Pie or die http://codeforces.com/problemset/problem/55/C 博弈论 乱搞 获胜条件是存在一个棋子到边界的值小于5 */ #in ...

随机推荐

  1. toFixed()与toPrecision()

    toFixed(n): 返回一个字符串,代表一个以定点表示法表示的数字. n在0~20之间 var g=1.023; var f=g.toFixed(2); f的值为:1.02,     typeof ...

  2. sql 各种锁

    SELECT * FROM table WITH (HOLDLOCK) 注意: 锁定数据库的一个表的区别 SELECT * FROM table WITH (HOLDLOCK) 其他事务可以读取表,但 ...

  3. Zooming

    Zooming 是一款纯 javascript 图片缩放库,主要特点有: 不依赖其他库,纯 JavaScript 实现,支持移动设备: 流畅的动画: 可缩放高清图像: 易于集成和定制. 使用方法 1. ...

  4. python 字符串的I/O 操作

    想使用操作类文件对象的程序来操作文本或二进制字符串 使用io.StringIO() 和io.BytesIO() 类来创建类文件对象操作字符串数据 >>> s = io.StringI ...

  5. 【R】书籍推荐

    From: http://xccds1977.blogspot.com/2013/02/r.html http://www.1point3acres.com/bbs/thread-51301-1-1. ...

  6. java后台获取和js拼接展示信息

    java后台获取和js拼接展示信息: html页面代码: <div class="results-bd"> <table id="activityInf ...

  7. Linux服务器配置---ftp用户黑名单

    用户黑白名单 一个Linux主机中会多个用户,而我们希望有些用户不能去访问ftp.ftp服务器可以通过配置文件“/etc/vsftpd/user_list”来设置一个用户列表,这个列表可以是黑名单,也 ...

  8. MySQL数据库----基础操作

    一.知识储备 数据库服务器:一台计算机(对内存要求比较高) 数据库管理系统:如mysql,是一个软件 数据库:oldboy_stu,相当于文件夹 表:student,scholl,class_list ...

  9. jQuery 对象

    jQuery 对象 版权声明:未经博主授权,严禁转载分享 什么是 jQuery 对象 jQuery 对象是通过 jQuery 包装 DOM 对象后产生的对象. jQuery 对象是一个类数组对象. j ...

  10. HTML 和 JavaScript 编写简单的 404 界面

    编写简单的 404 界面,也可以用来做 500 报错界面,还会飘东西,特别好,蛮漂亮的! <!DOCTYPE html> <html> <head> <met ...