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. win7下把电脑设置成wlan热

    有很多公司没有无线网,只有自己的电脑可以上网,现在设置热点,可以手机上网 步骤: 1.看自己的网卡是否支持承载网络,如果不支持,本法就不适用 在CMD里用    netsh wlan show dri ...

  2. JavaScript:Array属性方法

    ,,,,]; console.dir(arr); var pro=Object.getPrototypeOf(arr); console.dir(pro); 来一个个的查看数组的属性,方法 1.Arr ...

  3. hdu 6444 网络赛 Neko's loop(单调队列 + 裴蜀定理)题解

    题意:有编号为0~n-1的n个游戏,每个活动都有一个价值(可为负),给你m,s和k,你可以从任意一个编号开始玩,但是下一个游戏必须是编号为(i + k)%n的游戏,你最多能玩m次游戏,问你如果最后你手 ...

  4. HDU 2571(dp)题解

    命运 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submiss ...

  5. BZOJ1632: [Usaco2007 Feb]Lilypad Pond SPFA+最短路计数

    Description 为了让奶牛们娱乐和锻炼,农夫约翰建造了一个美丽的池塘.这个长方形的池子被分成了M行N列个方格(1≤M,N≤30).一些格子是坚固得令人惊讶的莲花,还有一些格子是岩石,其余的只是 ...

  6. [TODO]The way to Go(9): 基本类型和运算符

    参考: Github: Go Github: The way to Go 基本类型和运算符 表达式是一种特定的类型的值,它可以由其它的值以及运算符组合而成. 每个类型都定义了可以和自己结合的运算符集合 ...

  7. Ubuntu 14.04 安装libssh

    参考: libssh [CMake] include command Ubuntu 14.04 安装libssh $ git clone https://github.com/substack/lib ...

  8. UVa 120 煎饼

    https://vjudge.net/problem/UVA-120 题意:颠倒连续子序列,使之成为升序. 思路:按照从大到小的顺序,依次选择出一个数字进行分析: ①如果该数字已经在正确的位置上,则不 ...

  9. MVC ---- EF三层代码

    1.DAL层 using Night.Models; using System; using System.Collections.Generic; using System.Data.Entity. ...

  10. WPF基础学习笔记整理 (四) 布局

    WPF使用的是容器(container)进行布局: WPF窗口(Window类型)只能包含单个元素,故为了放置多个元素并增强界面效果,引入了容器: WPF布局容器都派生自System.Windows. ...