AtCoder Beginner Contest 044 B - 美しい文字列 / Beautiful Strings
Time limit : 2sec / Memory limit : 256MB
Score : 200 points
Problem Statement
Let w be a string consisting of lowercase letters. We will call w beautiful if the following condition is satisfied:
- Each lowercase letter of the English alphabet occurs even number of times in w.
You are given the string w. Determine if w is beautiful.
Constraints
- 1≤|w|≤100
- w consists of lowercase letters (
a-z).
Input
The input is given from Standard Input in the following format:
w
Output
Print Yes if w is beautiful. Print No otherwise.
Sample Input 1
abaccaba
Sample Output 1
Yes
a occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.
Sample Input 2
hthth
Sample Output 2
No 题解:很简单 但是没有考虑长度为一的时候哇了两发
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <queue>
#include <stack>
using namespace std;
#define lowbit(x) (x&(-x))
#define max(x,y) (x>y?x:y)
#define min(x,y) (x<y?x:y)
#define MAX 100000000000000000
#define MOD 1000000007
#define pi acos(-1.0)
#define ei exp(1)
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f3f
#define mem(a) (memset(a,0,sizeof(a)))
typedef long long ll;
ll gcd(ll a,ll b){
return b?gcd(b,a%b):a;
}
bool cmp(int x,int y)
{
return x>y;
}
const int N=;
const int mod=1e9+;
int main()
{
std::ios::sync_with_stdio(false);
char a[];
scanf("%s",a);
int len=strlen(a);
if(len==) {
cout<<"No"<<endl;
return ;
}
sort(a,a+len);
int t=,flag=;
for(int i=;i<len;i++){
if(a[i]==a[i-]) t++;
else{
if(t%==) {
flag=;
break;
}
else t=;
}
}
if(flag) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return ;
}
AtCoder Beginner Contest 044 B - 美しい文字列 / Beautiful Strings的更多相关文章
- AtCoder Beginner Contest 044 C - 高橋君とカード / Tak and Cards
题目链接:http://abc044.contest.atcoder.jp/tasks/arc060_a Time limit : 2sec / Memory limit : 256MB Score ...
- AtCoder Beginner Contest 044 A - 高橋君とホテルイージー / Tak and Hotels (ABC Edit)
Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There is a hotel with ...
- AtCoder Beginner Contest 224
AtCoder Beginner Contest 224 A - Tires 思路分析: 判断最后一个字符即可. 代码如下: #include <bits/stdc++.h> using ...
- AtCoder Beginner Contest 173 题解
AtCoder Beginner Contest 173 题解 目录 AtCoder Beginner Contest 173 题解 A - Payment B - Judge Status Summ ...
- AtCoder Beginner Contest 100 2018/06/16
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...
- AtCoder Beginner Contest 052
没看到Beginner,然后就做啊做,发现A,B太简单了...然后想想做完算了..没想到C卡了一下,然后还是做出来了.D的话瞎想了一下,然后感觉也没问题.假装all kill.2333 AtCoder ...
- AtCoder Beginner Contest 053 ABCD题
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...
- AtCoder Beginner Contest 136
AtCoder Beginner Contest 136 题目链接 A - +-x 直接取\(max\)即可. Code #include <bits/stdc++.h> using na ...
- AtCoder Beginner Contest 137 F
AtCoder Beginner Contest 137 F 数论鬼题(虽然不算特别数论) 希望你在浏览这篇题解前已经知道了费马小定理 利用用费马小定理构造函数\(g(x)=(x-i)^{P-1}\) ...
随机推荐
- python3 open()函数调用方法简单示例
python3 open()函数调用简介.Python open() 方法用于打开一个文件,并返回文件对象,在对文件进行处理过程都需要使用到这个函数,如果该文件无法被打开,会抛出 OSError. 注 ...
- Tensorflow安装记录
一.安装Ubantu环境 下载ios 网址:http://cn.ubuntu.com/download/ 2.配合虚拟机进行安装环境 虚拟机直接百度下载即可 虚拟机采用 具体安装,虚拟机百度中很多记录 ...
- 数据库---mysql的介绍和安装
MySQL数据库 一.简介: mysql是数据库管理软件:套接字:服务端,客户端 支持并发:操作得是共享得数据 处理锁,数据安全,性能 用别人得软件,得照着别人得规范,组织自己得语法规则 二.概述: ...
- vuex操作
import Vuex from 'vuex' //引入Vue.use(Vuex) //加载到Vue中//创建一个数据存储对象var store=new Vuex.Store({ //state可以当 ...
- [vue]声明式导航和编程式导航
声明式导航和编程式导航 共同点: 都能进行导航,都可以触发路由,实现组件切换 区别: 写法不一样,声明式导航是写在组件的template中,通过router-link来触发,编程式导航写在js函数中, ...
- DLNg[结构化ML项目]第二周迁移学习+多任务学习
1.迁移学习 比如要训练一个放射科图片识别系统,但是图片非常少,那么可以先在有大量其他图片的训练集上进行训练,比如猫狗植物等的图片,这样训练好模型之后就可以转移到放射科图片上,模型已经从其他图片中学习 ...
- Centos 7 设置ssh只允许特定用户从指定的IP登录
1.编辑文件 /etc/ssh/sshd_config vi /etc/ssh/sshd_config 2.root用户只允许在如下ip登录AllowUsers root@203.212.4.117A ...
- 用iframe嵌入了一个微信公众号平台文章的URL
JS: $.ajaxPrefilter( function (options) { if (options.crossDomain && jQuery.support.cors) { ...
- [LeetCode] 34. Find First and Last Position of Element in Sorted Array == [LintCode] 61. Search for a Range_Easy tag: Binary Search
Description Given a sorted array of n integers, find the starting and ending position of a given tar ...
- 20165321 2017-2018-2《Java程序设计》课程总结
每周作业链接汇总 预备作业1:20165321 我期望的师生关系 预备作业2:20165321 学习基础与C语言学习心得 预备作业3:20165321预备作业3:Linux安装及命令入门 第一周作业: ...