题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1550

题解:

1.A+B 与C的交集必须>=n

2.A与C的交集必须>=n/2,B与C的交集必须>=n/2。

代码如下:

 #include <iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define ms(a, b) memset((a), (b), sizeof(a))
typedef long long ll;
const ll mod=1e9+; char a[], b[], c[];
int s1[],s2[],s3[],ss[]; void solve()
{
while(scanf("%s",a)!=EOF)
{
scanf("%s%s",b,c);
int n = strlen(a); ms(s1,); ms(s2,); ms(s3,), ms(ss,);
int m1 = , m2 = , m3 = ;
for(int i = ; i<n; i++)
{
s1[a[i]-]++; ss[a[i]-]++;
s2[b[i]-]++; ss[b[i]-]++;
s3[c[i]-]++;
} for(int i = ; i<; i++)
{
m1 += min(s1[i],s3[i]);
m2 += min(s2[i],s3[i]);
m3 += min(ss[i],s3[i]);
} if(m3<n || m1*<n || m2*<n)
puts("NO");
else
puts("YES");
//cout<<m1<<' '<<m2<<' '<<m3<<endl;
}
} int main()
{
solve();
return ;
}

CSU - 1550 Simple String —— 字符串的更多相关文章

  1. Water --- CSU 1550: Simple String

    Simple String Problem's Link:   http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1550 Mean: 略. analy ...

  2. 1550: Simple String (做得少的思维题,两个字符串能否组成另外一个字符串问题)

    1550: Simple String Submit Page    Summary    Time Limit: 1 Sec     Memory Limit: 256 Mb     Submitt ...

  3. 1550: Simple String 最大流解法

    http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1550 很久以前做的一题,当时队友用最大流做,现在我也是 这个转化为二分图多重匹配,就是一样的意 ...

  4. csu 1550(字符串处理思路题)

    1550: Simple String Time Limit: 1 Sec  Memory Limit: 256 MBSubmit: 481  Solved: 211[Submit][Status][ ...

  5. FZU - 2218 Simple String Problem(状压dp)

    Simple String Problem Recently, you have found your interest in string theory. Here is an interestin ...

  6. String 字符串,heredoc,nowdoc

    一个字符串可以用 4 种方式表达: 单引号 双引号 heredoc 语法结构 nowdoc 语法结构(自 PHP 5.3.0 起) 单引号 定义一个字符串的最简单的方法是用单引号把它包围起来(字符 ' ...

  7. Java String字符串/==和equals区别,str。toCharAt(),getBytes,indexOf过滤存在字符,trim()/String与StringBuffer多线程安全/StringBuilder单线程—— 14.0

    课程概要 String 字符串 String字符串常用方法 StringBuffer StringBuilder String字符串: 1.实例化String对象 直接赋值  String str=& ...

  8. [CareerCup] 1.3 Permutation String 字符串的排列

    1.3 Given two strings, write a method to decide if one is a permutation of the other. 这道题给定我们两个字符串,让 ...

  9. 03-Java String字符串详解

    1.Java字符串String A.实例化String字符串:直接赋值(更合理一些,使用较多).使用关键字new. B.String内容的比较 // TODO Auto-generated metho ...

随机推荐

  1. [JSOI 2015] 子集选取

    4475: [Jsoi2015]子集选取 Time Limit: 1 Sec  Memory Limit: 512 MBSubmit: 363  Solved: 255[Submit][Status] ...

  2. SpringMVC整合MongoDB

    首先,在pom文件中新增spring-data-mongodb的依赖: <dependency> <groupId>org.springframework.data</g ...

  3. 官方Java编码规范

    先由Sun制定,之后Sun把Java卖给了Oracle,最后就成了Oracle制定的了.但是版本比较旧了,停留在1999年. 相比Google的编码规范,罪名写的却别就是Sun采用的是4个空格进行缩进 ...

  4. Java文件夹操作,判断多级路径是否存在,不存在就创建(包括windows和linux下的路径字符分析),兼容Windows和Linux

    兼容windows和linux. 分析: 在windows下路径有以下表示方式: (标准)D:\test\1.txt (不标准,参考linux)D:/test/1.txt 然后在java中,尤其使用F ...

  5. Android -- 开机启动无界面后台程序

    简单的说,这是一个没有界面的后台运行的应用程序 而且,还有一功能:开机自启动,启动运行一个服务 程序结构非常简单,两个类,一个是service的扩展类,一个是BroadcastReceiver扩展类 ...

  6. 【转载】Websocket学习

    首先是在Tomcat里面看到Websocket的演示.很有意思. http://localhost:8080/examples/websocket/index.xhtml 里面有: Echo exam ...

  7. nginx-location rewrite

    location 语法 location 有”定位”的意思, 根据Uri来进行不同的定位. 在虚拟主机的配置中,是必不可少的,location可以把网站的不同部分,定位到不同的处理方式上. 比如, 碰 ...

  8. 介绍一个开源的SIP(VOIP)协议库PJSIP

    本文系转载,出处不可考. 假设你对SIP/VoIP技术感兴趣,哪希望你不要错过:),假设你对写出堪称优美的Code感兴趣 ,那么你也不可错过:) 这期间我想分析一下一个实际的协议栈的设计到实现的相关技 ...

  9. 使用CCriticalSection类的注意事项

    在类中使用CCriticalSection变量时,必需要将CCriticalSection变量定义为全局变量和静态变量,否则将出现没有定义的错误. 如: // a.h 文件 class A:publi ...

  10. SD 卡PIN定义

    转载:http://blog.sina.com.cn/s/blog_56e19aa70101avnw.html SD卡和TF卡接口引脚定义