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}\) ...
随机推荐
- wxPython:文本对话框TextEntryDialog
wxTextEntryDialog(wxWindow* parent, const wxString& message, const wxString& caption = " ...
- LigerUi遮罩的两个方法
$.ligerDialog.waitting('正在查询,请稍候...'); $.ligerDialog.close();
- js将一位数组分割成每三个一组
var data = [ {name:'Liming',age:'25'}, {name:'Liming',age:'25'}, {name:'Liming',age:'25'}, { ...
- Spark partitionBy
partitionBy 重新分区, repartition默认采用HashPartitioner分区,自己设计合理的分区方法(比如数量比较大的key 加个随机数 随机分到更多的分区, 这样处理数据倾斜 ...
- Linux更改IP地址
1.进入到root用户 2.执行命令:ifconfig 查看本机的名称 3.执行命令:ifconfig eth0 192.168.25.128 netmask 255.255.255.0 //eth ...
- js函数定义的三种方式
1.函数声明语法 function sum(num1, num2){ return num1 + num2; } 2.函数表达式定义 var sum = function (num1, num2){ ...
- Node.js学习看这里:基础、进阶、文章
Node.js是基于Chrome JavaScript运行时建立的一个平台,实际上它是对Google Chrome V8引擎进行了封装,它主要用于创建快速的.可扩展的网络应用. Node.js采用事件 ...
- react-router v4 使用 history 控制路由跳转
问题 当我们使用react-router v3的时候,我们想跳转路由,我们一般这样处理 我们从react-router导出browserHistory. 我们使用browserHistory.push ...
- node微信公众号开发---域名绑定
var TOKEN='weixin'; //必须与测试号所填写的Token相同 function checkSignature(params,token){ var key=[token,params ...
- 关于ASP.NET预编译(转自dudu)
为什么要用预编译? 博客园博客程序中.aspx和.ascx文件总共加起来有3000多个(博客模板中有大量的.ascx文件).如果使用动态编译,每次只要更新bin文件夹中的任何一个dll文件,动态编译至 ...