A Pangram
Codeforces Round #295 div2 的A题,题意是判读一个字符串是不是全字母句,也就是这个字符串是否包含了26个字母,无论大小写。
12
toosmallword
NO
35
TheQuickBrownFoxJumpsOverTheLazyDog
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的更多相关文章
- codeforces 520 Pangram
http://codeforces.com/problemset/problem/520/A A. Pangram time limit per test 2 seconds memory limit ...
- CF Pangram
Pangram time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...
- 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 ...
- 【codeforces 520A】Pangram
[题目链接]:http://codeforces.com/problemset/problem/520/A [题意] 给你一个字符串. 统计里面有没有出现所有的英文字母->'a'..'z' 每个 ...
- 2076 Problem F Quick Brown Fox
题目描述 A pangram is a phrase that includes at least one occurrence of each of the 26 letters, ‘a’. . . ...
- Codeforces Round #295 (Div. 2)
水 A. Pangram /* 水题 */ #include <cstdio> #include <iostream> #include <algorithm> # ...
- North America Qualifier (2015)
https://icpc.baylor.edu/regionals/finder/north-america-qualifier-2015 一个人打.... B 概率问题公式见代码 #include ...
- 46 Simple Python Exercises (前20道题)
46 Simple Python Exercises This is version 0.45 of a collection of simple Python exercises construct ...
- 记录python题
def mone_sorted(itera): new_itera = [] while itera: min_value = min(itera) new_itera.append(min_valu ...
随机推荐
- 学习PHP:PHP提取的时间出现不准确
php函数date("Y-n-d H-i-s"); 输出的时间与当地时间居然相差了8个小时. 原因是从php5.1.0开始,php.ini里加入了date.time ...
- 七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理 【转】
http://www.cnblogs.com/powertoolsteam/p/MVC_five.html 系列文章 七天学会ASP.NET MVC (一)——深入理解ASP.NET MVC 七天学会 ...
- Drools环境搭建
Eclipse3.5安装Drools6.5.0.Final插件 到Drools下载页面(现在是http://www.jboss.org/drools/downloads.html) -下载并解压Dro ...
- 跟着实例学习设计模式(9)-桥接模式bridge(结构型)
桥接模式属于结构型设计模式. 设计意图:将抽象部分与实现部分分离.使它们都能够独立的变化. 一看到设计意图,大家可能有些发懵,我们看到的继承和接口不都是抽象和实现分离的吗?尤其是接口和抽象类都是这种实 ...
- $ is not defined
$ is not defined 引入Jquery的顺序不正确,要把它放在第一个引入
- pom.xml基础配置
pom.xml基础配置: maven中,最让我迷惑的还是那一堆配置! 就拿这个属性配置来说: 我需要让整个项目统一字符集编码,就需要设定 <project.build.sourceEncodin ...
- iOS SDK具体解释之UIDevice(系统版本号,设备型号...)
原创Blog,转载请注明出处 blog.csdn.net/hello_hwc 欢迎关注我的iOS SDK具体解释专栏 blog.csdn.net/column/details/huangwenchen ...
- vscode 编译调试c/c++的环境配置
首先看了一下别人写的文章 http://blog.csdn.net/c_duoduo/article/details/51615381 在按照上文链接博主的安装步骤进行到MINGW的安装时出现一个问题 ...
- 【Android】getActionBar()为null的解决方法总结
前言 在使用 ActionBar的时候,有时候会爆出空指针异常,这是由于应用没有获取到 ActionBar 导致的,而导致应用没有获取到 ActionBar 的原因比較多.所以我们以下就来总结一下 A ...
- 转:static关键字的总结
static关键字的总结 C++的static有两种用法:面向过程程序设计中的static和面向对象程序设计中的static.前者应用于普通变量和函数,不涉及类:后者主要说明static在类中的作用. ...