zoukankan      html  css  js  c++  java
  • codeforces 520 A. Pangram (暴力)

    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

    给一个字符串,问这个字符串中是否26个字母都出现过(大小写只出现一个就算出现过)
    开个布尔数组,扫一遍即可。
    嘛,做两道水题放松下==
    反正也是要清的。
    /*************************************************************************
        > File Name: code/cf/#295/A.cpp
        > Author: 111qqz
        > Email: rkz2013@126.com 
        > Created Time: 2015年08月17日 星期一 04时05分12秒
     ************************************************************************/
    
    #include<iostream>
    #include<iomanip>
    #include<cstdio>
    #include<algorithm>
    #include<cmath>
    #include<cstring>
    #include<string>
    #include<map>
    #include<set>
    #include<queue>
    #include<vector>
    #include<stack>
    #define y0 abc111qqz
    #define y1 hust111qqz
    #define yn hez111qqz
    #define j1 cute111qqz
    #define tm crazy111qqz
    #define lr dying111qqz
    using namespace std;
    #define REP(i, n) for (int i=0;i<int(n);++i)  
    typedef long long LL;
    typedef unsigned long long ULL;
    const int inf = 0x7fffffff;
    bool v[30];
    int main()
    {
        int n;
        scanf("%d",&n);
        memset(v,false,sizeof(v));
        string st;
        cin>>st;
        for ( int i = 0 ; i < n ; i ++)
        {
        if (islower(st[i]))
        {
            v[st[i]-'a'] = true;
        }
        else
        {
            v[st[i]-'A'] = true;
        }
        }
        for ( int i = 0 ; i < 26 ; i++)
        {
        if (!v[i])
        {
            
            cout<<"NO"<<endl;
            return 0;
        }
        }
        cout<<"YES"<<endl;
      
        return 0;
    }
  • 相关阅读:
    玩转Web之easyui(一)-----easy ui datagird 分页
    【JavaEE基础】在Java中如何使用jdbc连接Sql2008数据库
    Android访问服务器(TOMCAT)乱码引发的问题
    工厂方法模式--结合具体例子学习工厂方法模式
    FatMouse' Trade
    简单工厂模式--结合实例学习简单工厂模式
    栈-----括号匹配+表达式计算
    Android控件之RadioGroup与RadioButton(单选控件)
    Android控件之CheckBox(复选框控件)
    Android控件之ToggleButton(多状态按钮)
  • 原文地址:https://www.cnblogs.com/111qqz/p/4735461.html
Copyright © 2011-2022 走看看