题意:给定一个长度为 n 的小写字母串。可以将出现次数大于等于2的字母全部变成另一个小写字母,问最后能否将该小写字母串的所有字母变成同一个字母

n<=1e5

思路:

 #include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair
#define N 1100000
#define MOD 1000000007
#define eps 1e-8
#define pi acos(-1)
#define oo 110000000000000 char a[N];
int b[N],c[N]; int read()
{
int v=,f=;
char c=getchar();
while(c<||<c) {if(c=='-') f=-; c=getchar();}
while(<=c&&c<=) v=(v<<)+v+v+c-,c=getchar();
return v*f;
} void swap(int &x,int &y)
{
int t=x;x=y;y=t;
} int main()
{
//freopen("1.in","r",stdin);
//freopen("1.out","w",stdout);
int n;
scanf("%d",&n);
scanf("%s",a+);
for(int i=;i<=n;i++) b[a[i]-'a'+]++;
if(n==) printf("Yes\n");
else
{
int flag=;
for(int i=;i<=;i++)
if(b[i]>=) flag=;
if(flag) printf("Yes\n");
else printf("No\n");
}
return ;
}

【CF1025A】Doggo Recoloring(签到)的更多相关文章

  1. codeforces#505--A Doggo Recoloring

    A. Doggo Recoloring time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. 【Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) A】 Doggo Recoloring

    [链接] 我是链接,点我呀:) [题意] 你可以把出现次数大于1的颜色换成其他颜色. 问你最后能不能全都变成同一种颜色 [题解] 判断一下有没有出现次数大于1的就好. 有的话.显然可以一直用它变颜色. ...

  3. Codeforces Round #505 Div. 1 + Div. 2

    传送门:>Here< 从来没打过\(CF\)(由于太晚了)-- 不知道开学了以后有没有机会能够熬夜打几场,毕竟到现在为止都是\(unrated\)好尴尬啊~ 今天早上打了几题前几天的比赛题 ...

  4. Codeforces Round #505 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)

    A : A. Doggo Recoloring time limit per test 1 second memory limit per test 256 megabytes input stand ...

  5. Codeforces Round #505 (Div 1 + Div 2 Combined) Solution

    从这里开始 题目列表 瞎扯 Problem A Doggo Recoloring Problem B Weakened Common Divisor Problem C Plasticine zebr ...

  6. #505 1&2 A-C 后面未完成

    A. Doggo Recoloring 题目意思是给一个字符串(都是小写字母),如果有两个字符相同,我们可以将这两个字符变成其他字符,问能不能使字符串字母都一样 思路  有两个相同字符时就能:  字符 ...

  7. Codeforces Round #505 (Div 1 + Div 2) (A~D)

    目录 Codeforces 1025 A.Doggo Recoloring B.Weakened Common Divisor C.Plasticine zebra D.Recovering BST( ...

  8. Codeforces Round #505

    Codeforces Round #505 A. Doggo Recoloring 题目描述:给定一个字符串,每次选择一个在字符串里面出现至少两次的字符,然后将这种字符变成那一种指定的字符,问最终这个 ...

  9. C#开发微信门户及应用(39)--使用微信JSSDK实现签到的功能

    随着微信开逐步开放更多JSSDK的接口,我们可以利用自定义网页的方式来调用更多微信的接口,实现我们更加丰富的界面功能和效果,例如我们可以在页面中调用各种手机的硬件来获取信息,如摄像头拍照,GPS信息. ...

随机推荐

  1. python从列表中删除相邻重复元素

    这里以一个栗子来用三种方法实现,输入a=['1','1','2','2','1','1'],输出b=['1', '2', '1'] 方法一: list1 = ['] def del_adjacent( ...

  2. 03大端和小端(Big endian and Little endian)

    1.大端和小端的问题 ​ 对于整型.长整型等数据类型,Big endian 认为第一个字节是最高位字节(按照从低地址到高地址的顺序存放数据的高位字节到低位字节),而 Little endian 则相反 ...

  3. python入门:py2.x里面除法或乘法这么写就可以计算小数点后面结果

    #!/usr/bin/env python # -*- coding:utf-8 -*- #py2.x里面除法或乘法这么写就可以计算小数点后面结果,更精确future(未来,译音:非忧车) divis ...

  4. 【netbeans】netbeans utf-8编码

    首先,在你的netbeans的安装文件夹里面找到etc这个文件夹,打开,在里面找到netbeans.conf这个文件,打开,找到这一句netbeans_default_options="-J ...

  5. 如何封装RESTful Web Service

    所谓Web Service是一个平台独立的,低耦合的,自包含的.可编程的Web应用程序,有了Web Service异构系统之间就可以通过XML或JSON来交换数据,这样就可以用于开发分布式的互操作的应 ...

  6. JAVA基础篇—多态

    class ColaEmployee父类 package com.cola; public class ColaEmployee { private String name; private int ...

  7. bash循环for/while/until

    shell流程控制之一:for循环     for VAR in LIST; do         STATEMENT1         ...     done         例:         ...

  8. HDU4010 Query on The Trees (LCT动态树)

    Query on The Trees Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Othe ...

  9. UVa 11651 Krypton Number System DP + 矩阵快速幂

    题意: 有一个\(base(2 \leq base \leq 6)\)进制系统,这里面的数都是整数,不含前导0,相邻两个数字不相同. 而且每个数字有一个得分\(score(1 \leq score \ ...

  10. ogre的初始化与启动以及显示对象设置

    ogre的使用方法1---自动设置 1.ogre初始化:首先实例化一个Root对象 Root * root = new Root(); Root * root = new Root("plu ...