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 }
  • 相关阅读:
    Leetcode 笔记 110
    Leetcode 笔记 100
    Leetcode 笔记 99
    Leetcode 笔记 98
    Leetcode 笔记 101
    Leetcode 笔记 36
    Leetcode 笔记 35
    Leetcode 笔记 117
    Leetcode 笔记 116
    android加载速度优化,通过项目的优化过程分析
  • 原文地址:https://www.cnblogs.com/xz816111/p/4399700.html
Copyright © 2011-2022 走看看