CodeForces - 955B(用char会超时。。。)
#include <bits/stdc++.h>
#define mem(a, b) memset(a, b, sizeof(a))
using namespace std;
const int maxn = , INF = 0x7fffffff;
string str;
int vis[];
int main()
{
cin>> str;
mem(vis, );
int cnt = , ans = ;
for(int i=; i<str.size(); i++)
vis[str[i] - 'a']++;
for(int i=; i<; i++)
if(vis[i])
{
cnt++;
if(vis[i] >= )
ans++;
if(cnt > )
{
cout<< "No" <<endl;
return ;
}
}
if(cnt == )
{
cout<< "No" <<endl;
}
else if(cnt == )
{
if(ans == )
cout<< "Yes" <<endl;
else
cout<< "No" <<endl;
}
else if(cnt == )
{
if(ans)
cout<< "Yes" <<endl;
else
cout<< "No" <<endl;
}
else if(cnt == )
cout<< "Yes" <<endl; return ;
}
CodeForces - 955B(用char会超时。。。)的更多相关文章
- 存储过程参数CHAR传过来null导致超时.
调用的时候不要传NULL,可以传 '' ALTER PROCEDURE [dbo].[up_UC_GetUCExecuteEPList] @Code VARCHAR(3) ,--ch ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C (用map 超时)
C. Bear and Colors time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #304 (Div. 2)-D. Soldier and Number Game,素因子打表,超时哭晕~~
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input s ...
- Codeforces Round #451 (Div. 2)-898A. Rounding 898B.Proper Nutrition 898C.Phone Numbers(大佬容器套容器) 898D.Alarm Clock(超时了,待补坑)(贪心的思想)
A. Rounding time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- 计数排序 + 线段树优化 --- Codeforces 558E : A Simple Task
E. A Simple Task Problem's Link: http://codeforces.com/problemset/problem/558/E Mean: 给定一个字符串,有q次操作, ...
- dp --- Codeforces 245H :Queries for Number of Palindromes
Queries for Number of Palindromes Problem's Link: http://codeforces.com/problemset/problem/245/H M ...
- Codeforces Zepto Code Rush 2014 -C - Dungeons and Candies
这题给的一个教训:Codeforces没有超时这个概念.本来以为1000*(1000+1)/2*10*10要超时的.结果我想多了. 这题由于k层都可能有关系,所以建一个图,每两个点之间连边,边权为n* ...
- CodeForces 222B Cosmic Tables
Cosmic Tables Time Limit:3000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Subm ...
- DFS/BFS Codeforces Round #301 (Div. 2) C. Ice Cave
题目传送门 /* 题意:告诉起点终点,踩一次, '.'变成'X',再踩一次,冰块破碎,问是否能使终点冰破碎 DFS:如题解所说,分三种情况:1. 如果两点重合,只要往外走一步再走回来就行了:2. 若两 ...
随机推荐
- 使GDAL库支持中文路径或中文文件名的处理方法
之前生成的gdal 2.1.1动态库,在通过命令行执行时,遇到有中文路径或中文图像名时,GDALOpen函数不能正确的被调用,如下图: 解决方法: 1. 在所有使用GDALAllRegist ...
- CF 833 B. The Bakery
B. The Bakery http://codeforces.com/contest/833/problem/B 题意: 将一个长度为n的序列分成k份,每份的cost为不同的数的个数,求最大cost ...
- python实现socket通信
python实现socket很简单,保证你的环境有响应的python环境就可以,我使用的是socket,demo代码如下: server端程序: # coding:utf-8 import socke ...
- [css 揭秘] :CSS揭秘 技巧(五):条纹背景
条纹背景 https://github.com/FannieGirl/ifannie/问题:条纹背景 在设觉设计中无处不在,我们真的可以用css 创建图案吗? 这一章相对还是比较复杂的哦!一起get. ...
- Introduction to Locking in SQL Server
Locking is a major part of every RDBMS and is important to know about. It is a database functionalit ...
- [转]git命令之git remote的用法
git remote git remote -v git init git add xxx git commit -m 'xxx' git remote add origin ssh://softw ...
- 《图解 HTTP 》阅读 —— 第二章
第2章 简单的http协议 http 协议用于客户端和服务器端的通信. 请求访问文本或图像等资源的一端称为客户端,提供资源响应的一端称为服务器端. 请求报文: 响应报文: 为了能够处理大量的事务,ht ...
- PytorchZerotoAll学习笔记(五)--逻辑回归
逻辑回归: 本章内容主要讲述简单的逻辑回归:这个可以归纳为二分类的问题. 逻辑,非假即真.两种可能,我们可以联想一下在继电器控制的电信号(0 or 1) 举个栗子:比如说你花了好几个星期复习的考试(通 ...
- Linux虚拟机centos系统安装
linux 其他知识目录 安装完后如果虚拟机网络不通请参考:虚拟机网络不通故障解决 1.centos6.9安装 后面安装出了点问题,ip没有并且eth0网卡找不到,不过重新配置ifcfg-eth0后重 ...
- 第七次ScrumMeeting博客
第七次ScrumMeeting博客 本次会议于11月1日(三)22时整在3公寓725房间召开,持续15分钟. 与会人员:刘畅.辛德泰.窦鑫泽.张安澜.赵奕.方科栋. 1. 每个人的工作(有Issue的 ...