Alphabet Cookies
来源:互联网 发布:webgame 源码下载 编辑:程序博客网 时间:2024/05/17 04:42
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;}
1 0
- Alphabet Cookies
- Alphabet Cookies
- 字符串、、、水题。Alphabet Cookies
- Alphabet
- HCPC2014校赛训练赛 4 A.Alphabet Cookies (3.16)
- funny alphabet
- Greek alphabet
- Google Alphabet
- greek alphabet
- cookies
- Cookies
- Cookies
- Cookies
- Cookies
- Cookies
- cookies()
- Cookies
- Cookies
- Xamarin.android 抽屉效果(SlideMenu)
- 第十周leetcode题
- OpenGL学习笔记
- 使用python一键登录博客
- Kibana displays customized percentage in pie chart
- Alphabet Cookies
- MySQL数据库(19)
- Codeforces Round #411 (Div. 2)
- Bootstrap <第一篇>
- LeetCode:Sort List
- Annotation
- Angularjs中的自定义指令
- JDBC
- HDU 1260 Tickets 简单dp