Alphabet Cookies


题目描述

Kitty likes cookies very much, and especially the alphabet cookies. Now, she get some alphabet cookies, and she wants to select some of them to spell some words.

The easy task for you, is to determine that whether she can spell the word she wants.

输入

The input contains several test cases.

Each test case contains an integer N ( 0 < N ≤ 100 ) in a line.

And followed a line with N capital letters, means the cookies she has.

Then the last line is a word with capital letters. And the word’s length isn’t more than N.

输出

One word for each test case. If she can spell the word by these letters, please output “Yes”, nor output “No”.

样例输入

7ARDHPYPHAPPY6ARDHPYHAPPY

样例输出

YesNo

题意:

给出现在拥有的饼干数,问使用这些饼干是否可以拼成下面的字母

解题思路:
水题,暴力比较就好

代码如下:
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<algorithm>
using namespace std;
int main()
{
int i,j;
int aa[100];
char ch[1000];
char str[1000];
int n,m;
while(~scanf("%d",&n)){
scanf("%s %s",str,ch);
m=0;
int len=strlen(ch);
for(i=0;i<n;i++){
for(j=0;j<len;j++){
if(str[i]==ch[j]){
ch[j]='#';
m++;
break;
}
}
}
if(m<len){
printf("No\n");
}else printf("Yes\n");
}
return 0;
}

Alphabet Cookies的更多相关文章

  1. WUSTOJ 1321: Alphabet Cookies(Java)字符统计

    题目链接:1321: Alphabet Cookies Description Kitty likes cookies very much, and especially the alphabet c ...

  2. scrapy cookies:将cookies保存到文件以及从文件加载cookies

    我在使用scrapy模拟登录新浪微博时,想将登录成功后的cookies保存到本地,下次加载它实现直接登录,省去中间一系列的请求和POST等.关于如何从本次请求中获取并在下次请求中附带上cookies的 ...

  3. ASP.Net MVC Session和Cookies的简单使用

    目标:用Session和Cookies实现登陆信息保存和展现 Cookies实现: Controller: //把登陆用户名存到cookies中 HttpCookie cook = new HttpC ...

  4. Webform(六)——登录状态保持(Cookies内置对象)

    用户用浏览器访问一个网站,由于采用的http的特性,Web服务器并不能知道是哪一个用户正在访问,但一些网站,希望能够知道访问者的一些信息,例如是不是第一次访问,访问者上次访问时是否有未做完的工作,这次 ...

  5. [LeetCode] Assign Cookies 分点心

    Assume you are an awesome parent and want to give your children some cookies. But, you should give e ...

  6. jquery缓存使用jquery.cookies.2.2.0.min.js

    $.cookies.set(key, obj, { hoursToLive: 2}); key标识的键 , obj存入的值可以缓存json对象, hoursToLive 缓存小时数 $.cookies ...

  7. C# HttpWebRequest获取COOKIES

    C# HttpWebRequest获取COOKIES byte[] bytes = Encoding.Default.GetBytes(_post); CookieContainer myCookie ...

  8. HTML5-本地存储与cookies

    一.H5的几种存储形式 1.本地存储(localstorage和sessionstorage) 存储形式:key-->value 过期策略:localstorage永久存储,不过期,除非手动删除 ...

  9. scrapy加载cookies登陆

    import scrapy from xxxx.items import XXXXItem from scrapy.http.request import Request class ZndsSpid ...

随机推荐

  1. bootstrap的carousel图片轮播

    整个轮播是放在一个div .carousel和.slide的div中的, 包括3个部分: 1. 第一个部分indicator位于下方的指示器部分. 结构是一个ol和li, ol的类是carousel- ...

  2. 括号序和dfs序

    记得清北讲过括号序和dfs序,忘记了 dfs序 dfs序就是dfs的顺序,这个好记 就是在dfs遍历树的时候,将每个结点开始时记录一次,结束时记录一次 而且一个子树可以表示为连续的一段, 只有子树操作 ...

  3. Linq let Concat

    let: String[] strs = { "A penny saved is a penny earned.", "The early bird catches th ...

  4. git源码阅读

    https://github.com/git-for-windows/git/issues/1854 https://github.com/git-for-windows/git/pull/1902/ ...

  5. ActiveMQ 负载均衡与高可用(转载)

    一.架构和技术介绍 1.简介 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现 2.activemq的 ...

  6. iis发布,部署

    1.项目发布:选择iis:文件系统:文件路径:realese 2.iis添加: 3.host文件添加 问题1: 不能在此路径中使用此配置节.如果在父级别上锁定了该节,便会出现这种情况.锁定 在全新安装 ...

  7. NetMagic Simple Overview

    参考: NetMagic Startup: How to develop NetMagic rapidly NetMagic Simple Overview NetMagic 是什么? NetMagi ...

  8. 【异常记录(八)】 This operation requires IIS integrated pipeline mode.

    突然提示这个Error: Server Error in '/' Application. This operation requires IIS integrated pipeline mode. ...

  9. C# ashx接收ContentType="text/xml"类型值

    public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain&qu ...

  10. json.dump()和json.dmups()的区别

    在python中支持json合适的数据是通过json模块实现的. 在序列化json数据的时候遇到两个形状很像的函数,dump()和dumps().主要说说他们的区别 先看看官方文档的说明:https: ...