↓ 跳过正文
  1. Posts/

uva 1583 B - Digit Generator (暴力)

相关文章

codeforces #519 A A. Multiplication Table (暴力)

·385 字·1 分钟
A. Multiplication Table time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let’s consider a table consisting of n rows and n columns. The cell located at the intersection of i-th row and j-th column contains number i × j. The rows and columns are numbered starting from 1. You are given a positive integer x. Your task is to count the number of cells in a table that contain number x.

codeforces 520 A. Pangram (暴力)

·267 字·1 分钟
给一个字符串,问这个字符串中是否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}

codeforces 569 C Primes or Palindromes? (暴力)

·475 字·1 分钟
先预处理出来比小于等于n的素数的个数和回文数的个数… 素数不筛竟然也可以过 然后暴力就好. 需要注意的是,比值并不单调,找最大的n,可能之前某个数开始不满足条件,之后又有满足条件的了.