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. Input消除自动记忆功能

    在html里就可以直接清除了<input type="text" autocomplete="off"> input 的autocomplete属性 ...

  2. sql 中延时操作

    select 1; WAITFOR DELAY '00:00:30'; select 2; --执行完第一个之后会 延时 30秒,才会执行第二个sql

  3. python之路 socket、socket server

    一.socket socket的英文原义是“孔”或“插座”.作为BSD UNIX的进程通信机制,取后一种意思.通常也 称作"套接字",用于描述IP地址和端口,是一个通信链的句柄,可 ...

  4. Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) C. Maximum splitting

    地址: 题目: C. Maximum splitting time limit per test 2 seconds memory limit per test 256 megabytes input ...

  5. Linux root用户下强制静音的问题

    解决方法 pulseaudio --start --log-target=syslog suorce /etc/profile

  6. Manacher 计算最长回文串

    转自 http://blog.sina.com.cn/s/blog_3fe961ae0101iwc2.html 寻找字符串中的回文,有特定的算法来解决,也是本文的主题:Manacher算法,其时间复杂 ...

  7. [SQL入门级] 这篇咱'薄利多销',记录多一点

    这个系列的博文知识回顾sql知识作的记录,温故而知新.上一篇内容达不到知识分享的层级被移出园子首页,对不住各位看官,内容简单了些.下面咱就记录多一些的基础知识,薄利多销: 控制用户权限 • 创建用户 ...

  8. android实操--练习2

    练习2是实现一个计算器的功能:可以加减乘除:可以倒退,可以清空文本. 下面是效果展示: -----------------------布局------------------------------- ...

  9. C++ Word Count 发布程序

    前段时间,模仿 Linux 系统下的 wc 程序,在 Windows 系统环境下使用 C/C++ 实现了一个相似的 WC 程序,只不过有针对性,针对的是 C/C++,Java 等风格的源代码文件. 此 ...

  10. xdebug安装方法

    打开网址:https://xdebug.org/wizard.php 把phpinfo页面中输出的所有内容复制过来,粘贴在此处点下面那个按钮,系统会分析出你需要下载哪个版本的x-debug,还会告诉你 ...