zoukankan      html  css  js  c++  java
  • Codeforces Round #295 (Div. 2)——A——Pangram

    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
    大意:只要简单排序,统计与原来字母表多少一样的就行
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    using namespace std;
    int main()
    {
        char s[105],s2[30] = {"abcdefghijklmnopqrstuvwxyz"};
        int n;
        while(~scanf("%d",&n)){
                getchar();
                scanf("%s",s);
                for(int i = 0; i < n ; i++)
                        if(s[i] >='A'&&s[i] <= 'Z')
                         s[i] = s[i] - 'A' + 'a';
                sort(s,s+n);
               int count = 0;
               for(int i = 0; i < n ; i++){
                    if(s[i] == s2[count])
                    count++;
               }
               if(count == 26)
                printf("YES
    ");
               else printf("NO
    ");
        }
        return 0;
    }
    View Code
     
  • 相关阅读:
    关于Python解释器
    进程和线程
    Python
    高等数学
    关于Bulk加载模式
    使用Update Strategy组件无法进行delete操作
    3.15 晚会—「饿了么」之殇
    JavaScript 踩坑心得— 为了高速(下)
    JavaScript 踩坑心得— 为了高速(上)
    从零开始运维之旅:如何监控你的 Windows?
  • 原文地址:https://www.cnblogs.com/zero-begin/p/4350026.html
Copyright © 2011-2022 走看看