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. dede实战系统:更换成kindEditor编辑器

    最近由于项目需要,在搞dedeCMS,发现dede自带的ckEditor在word粘贴这方面做得不是很好,从word上面直接ctrl+V的内容跟wrod上面的表现样式相差很大,客户很不爽(因为是编辑的 ...

  2. goreplay使用

    最新版的发布公告:https://leonsbox.com/goreplay-v0-16-and-4th-anniversary-5408b1fd72e0 主要提到:中间件.报文解压.从kafka读取 ...

  3. 两段用来启动/重启Linux下Tomcat的Perl脚本

    两段代码,第二段比较好些. 下面是Split输出结果方式的代码: #!/usr/local/bin/perl #Date:2015-07-07 print "Begin to restart ...

  4. 解释一下Windows dos中的符号

    容许我放一段Windows的批处理: sc <server> [command] [service name] <option1> <option2>... < ...

  5. cart算法

  6. Android开发之短信验证码示例

    在说Android中的短信验证码这个知识点前,我们首先来了解下聚合数据 聚合数据介绍 聚合数据是一家国内最大的基础数据API提供商,专业从事互联网数据服务.免费提供从天气查询.空气质量.地图坐标到金融 ...

  7. 登陆界面综合实例+spinner下拉列表框详解

      点击确定: 点击修改:     想到Spinner下拉按钮可以通过两种方法生成 方法一: 1.在array数组里面定义数组 代码如下: <resources> <st <? ...

  8. jq:正则表达式

    var checkNum = /^[A-Za-z0-9]+$/;   注意没有引号 checkNum.test(这里添加待匹配的字符串); var textNull=/^\s*$/; if(textN ...

  9. Linux ps 命令查看进程启动及运行时间

    引言 同事问我怎样看一个进程的启动时间和运行时间,我第一反应当然是说用 ps 命令啦.ps aux或ps -ef不就可以看时间吗? ps aux选项及输出说明 我们来重新复习下ps aux的选项,这是 ...

  10. centos配置ip

    /etc/sysconfig/network-scripts/ifcfg-eth0文件做如下修改 DEVICE=eth0 HWADDR=08:00:27:46:1D:E1 TYPE=Ethernet ...