zoukankan      html  css  js  c++  java
  • codeforces 520 Pangram

    http://codeforces.com/problemset/problem/520/A

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

    A word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test the output devices.

    You are given a string consisting of lowercase and uppercase Latin letters. Check whether this string is a pangram. We say that the string contains a letter of the Latin alphabet if this letter occurs in the string in uppercase or lowercase.

    Input

    The first line contains a single integer n (1 ≤ n ≤ 100) — the number of characters in the string.

    The second line contains the string. The string consists only of uppercase and lowercase Latin letters.

    Output

    Output "YES", if the string is a pangram and "NO" otherwise.

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


    分析:

    就是判断每一个字母是否都出现一次,大小写不计。


    AC代码:

     1 #include <stdio.h>
     2 #include <algorithm>
     3 #include <iostream>
     4 #include <string.h>
     5 #include <string>
     6 #include <math.h>
     7 #include <stdlib.h>
     8 #include <queue>
     9 #include <stack>
    10 #include <set>
    11 #include <map>
    12 #include <list>
    13 #include <iomanip>
    14 #include <vector>
    15 #pragma comment(linker, "/STACK:1024000000,1024000000")
    16 #pragma warning(disable:4786)
    17 
    18 using namespace std;
    19 
    20 const int INF = 0x3f3f3f3f;
    21 const int MAX = 200 + 10;
    22 const double eps = 1e-8;
    23 const double PI = acos(-1.0);
    24 
    25 char str;
    26 map<char , int>ma;
    27 
    28 int main()
    29 {
    30     int n;
    31     while(~scanf("%d",&n))
    32     {
    33         ma.clear();
    34         int i;
    35         for(i = 0;i <= n;i ++)
    36         {
    37             scanf("%c", &str);
    38             if(str >= 'A' && str <= 'Z')
    39                 ma[str - 'A'] ++;
    40             else
    41                 ma[str - 'a'] ++;
    42         }
    43         for(i = 0;i < 26;i ++)
    44             if(ma[i] == 0)
    45             {
    46                 cout << "NO" << endl;
    47                 break;
    48             }
    49         if(i == 26)
    50             cout << "YES" << endl;
    51     }
    52     return 0;
    53 }
    View Code
  • 相关阅读:
    Spring Security -- 添加图形验证码(转载)
    Spring Security -- 自定义用户认证(转载)
    pandas agg 后降低df表层
    判断是否有人跟踪车辆的方案
    格隆汇笔记-黄勇演讲
    Mac mysql 忘记root密码的解决方法
    sql 同步2个表中的一个字段数据
    Linux下配置用msmtp和mutt发邮件
    spark StructType的应用,用在处理mongoDB keyvalue
    Idea2018旗舰版破解方法
  • 原文地址:https://www.cnblogs.com/jeff-wgc/p/4458404.html
Copyright © 2011-2022 走看看