Codeforces Round #295 div2 的A题,题意是判读一个字符串是不是全字母句,也就是这个字符串是否包含了26个字母,无论大小写。

Sample test(s)
input
12
toosmallword
output
NO
input
35
TheQuickBrownFoxJumpsOverTheLazyDog
output
YES

input 的第一行是字符串的长度,第二行是字符串,output的话,如果不是pangram就输出NO,否则输出YES

因为只要判断是否包含26个字母,所以,如果字符串长度小于26的话,根本上是不可能的,然后,遍历字符串的每个字符,把出现的字母记录下来(打表),最后,判断26个字母是否都包含,很简单的一道题。

#include <iostream>
#include <ctype.h>
#include <string>
using namespace std;
int alph[27];
int main(){
string s;
int n, i;
cin >> n;
cin >> s;
if(n < 26){
cout << "NO"; return 0;
} for( i = 0; i < n; i++){
char c = s[i];
c = tolower(c);
alph[c-97] = 1;
}
for( i = 0; i < 26; i++){
if(!alph[i]) break;
}
if(i == 26) cout << "YES";
else cout << "NO";
return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

A Pangram的更多相关文章

  1. codeforces 520 Pangram

    http://codeforces.com/problemset/problem/520/A A. Pangram time limit per test 2 seconds memory limit ...

  2. CF Pangram

    Pangram time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...

  3. Codeforces Round #295 (Div. 2)A - Pangram 水题

    A. Pangram time limit per test 2 seconds memory limit per test 256 megabytes input standard input ou ...

  4. 【codeforces 520A】Pangram

    [题目链接]:http://codeforces.com/problemset/problem/520/A [题意] 给你一个字符串. 统计里面有没有出现所有的英文字母->'a'..'z' 每个 ...

  5. 2076 Problem F Quick Brown Fox

    题目描述 A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . . ...

  6. Codeforces Round #295 (Div. 2)

    水 A. Pangram /* 水题 */ #include <cstdio> #include <iostream> #include <algorithm> # ...

  7. North America Qualifier (2015)

    https://icpc.baylor.edu/regionals/finder/north-america-qualifier-2015 一个人打.... B 概率问题公式见代码 #include ...

  8. 46 Simple Python Exercises (前20道题)

    46 Simple Python Exercises This is version 0.45 of a collection of simple Python exercises construct ...

  9. 记录python题

    def mone_sorted(itera): new_itera = [] while itera: min_value = min(itera) new_itera.append(min_valu ...

随机推荐

  1. 第十八章 Python批量管理主机(paramiko、fabric与pexpect)

    这个人的文章不错:http://lizhenliang.blog.51cto.com/all/7876557 转载:http://lizhenliang.blog.51cto.com/7876557/ ...

  2. MyEclipse 中自定义日期格式

    从数据库中读出Data数据: 而想实现的是这样: 解决办法: 1. 在这个类里添加自定义的变量birthf: public abstract class AbstractUsers implement ...

  3. java 环境变量配置 Mac

    大家在windows里面配置JDK环境变量很容易,但是如果要在mac里面配置JDK环境变量和windows里面有所不同,具体如下: 第一: mac OS里面自带jdk,不过是1.6的版本,现在很多人使 ...

  4. 96Boards扩展板 STM32 B96B-F446VE 牛刀小试

    前言 原创文章,转载引用务必注明链接,水平有限,如有疏漏,欢迎指正. 本文使用Markdown写成,为获得更好的阅读体验和正常的链接.图片显示,请访问我的博客原文: http://www.cnblog ...

  5. C#遍历指定路径下的目录

    通过指定路径訪问路径下的文件.在C#的开发中主要利用了Directory类和DirectoryInfo类,简要介绍Directory类中的成员:命名空间 System.IO 命名空间 1.Create ...

  6. 【Python数据分析】IPython快捷键

    命令                          说明 CTRL+P(或向上箭头)             后向搜索命令历史中以当前输入的文本开头的命令 CTRL+N(或向下箭头)        ...

  7. 文件I/O操作为什么叫输入/出流

    参考以下文档: http://blog.csdn.net/hguisu/article/details/7418161 我们关注的焦点是错误的,重点不在文件,我们关注的核心是数据流. 这种流可以是文本 ...

  8. 命令行运行java

    运行TestLinuxCommand.java     代码 import java.io.BufferedReader; import java.io.BufferedWriter; import ...

  9. HttpClient 模拟登录搜狐微博

    http://mengyang.iteye.com/blog/575671 第一次遇到一个这样的问题,"PKIX path building failed" 异常   详解异常:  ...

  10. 关于PM的认识

    1 我眼中的PM 1.1 人云“一个管理,半个专家”,我说“一个管理,两个专家” 如今,我发现我们不得不面对这样一个现实——角色兼职.我习惯上把项目分为三类:性命攸关的项目(涉及到人身安全的项目,如铁 ...