zoukankan      html  css  js  c++  java
  • CF Pangram

    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


    题意为判断这句话里是否26个字母都出现过,没什么好说的。
     1 #include <iostream>
     2 #include <cstring>
     3 #include <cstdio>
     4 #include <string>
     5 #include <algorithm>
     6 #include <cctype>
     7 #include <queue>
     8 using    namespace    std;
     9 
    10 int    main(void)
    11 {
    12     char    s[105];
    13     bool    vis[26] = {false};
    14     int    n;
    15 
    16     scanf("%d",&n);
    17     scanf("%s",s);
    18     for(int i = 0;s[i];i ++)
    19         if(isupper(s[i]))
    20             vis[s[i] - 'A'] = true;
    21         else
    22             vis[s[i] - 'a'] = true;
    23     
    24     for(int i = 0;i < 26;i ++)
    25         if(!vis[i])
    26         {
    27             puts("NO");
    28             return    0;
    29         }
    30     puts("YES");
    31     return    0;
    32 }
  • 相关阅读:
    第一章数据结构——实现线性表
    hdu 4454 Stealing a Cake(三分之二)
    找呀志_java网络编程(4)TCP/IP、Http和Socket差额
    Velocity脚本新手教程
    2015第15周日PostgreSQL学习
    2015第15周六Java线程池
    2015第15周五寻找身边聪明的人
    2015第15周四
    2015第15周三
    2015第15周二
  • 原文地址:https://www.cnblogs.com/xz816111/p/4399700.html
Copyright © 2011-2022 走看看