↓ Skip to main content
  1. Posts/

codeforces 520 A. Pangram (暴力)

·267 words·1 min
Note: This article is available in Chinese only. 本文暂无英文版本。 View original

给一个字符串,问这个字符串中是否26个字母都出现过(大小写只出现一个就算出现过) 开个布尔数组,扫一遍即可。 嘛,做两道水题放松下== 反正也是要清的。

代码实现
 1/*************************************************************************
 2	> File Name: code/cf/#295/A.cpp
 3	> Author: 111qqz
 4	> Email: rkz2013@126.com
 5	> Created Time: 2015年08月17日 星期一 04时05分12秒
 6 ************************************************************************/
 7
 8#include<iostream>
 9#include<iomanip>
10#include<cstdio>
11#include<algorithm>
12#include<cmath>
13#include<cstring>
14#include<string>
15#include<map>
16#include<set>
17#include<queue>
18#include<vector>
19#include<stack>
20#define y0 abc111qqz
21#define y1 hust111qqz
22#define yn hez111qqz
23#define j1 cute111qqz
24#define tm crazy111qqz
25#define lr dying111qqz
26using namespace std;
27#define REP(i, n) for (int i=0;i<int(n);++i)
28typedef long long LL;
29typedef unsigned long long ULL;
30const int inf = 0x7fffffff;
31bool v[30];
32int main()
33{
34    int n;
35    scanf("%d",&n);
36    memset(v,false,sizeof(v));
37    string st;
38    cin>>st;
39    for ( int i = 0 ; i < n ; i ++)
40    {
41	if (islower(st[i]))
42	{
43	    v[st[i]-'a'] = true;
44	}
45	else
46	{
47	    v[st[i]-'A'] = true;
48	}
49    }
50    for ( int i = 0 ; i < 26 ; i++)
51    {
52	if (!v[i])
53	{
54
55	    cout<<"NO"<<endl;
56	    return 0;
57	}
58    }
59    cout<<"YES"<<endl;
60
61	return 0;
62}

Related

cf 570 C. Replacement (暴力)

·1010 words·3 mins
C. Replacement time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Daniel has a string s, consisting of lowercase English letters and period signs (characters ‘.’). Let’s define the operation of replacement as the following sequence of steps: find a substring “..” (two consecutive periods) in string s, of all occurrences of the substring let’s choose the first one, and replace this substring with string “.”. In other words, during the replacement operation, the first two consecutive periods are replaced by one. If string s contains no two consecutive periods, then nothing happens.