这个问题是比较暴力的法律主体。

主要是检查每一个是否没有使用足够的?。假设优先使用其他的无论是什么字母,假设你一定不能使用?。

找一个有能力并给予所有的字符串匹配字符串,而且采用的最小?号码。

原标题连接:http://codeforces.com/problemset/problem/412/C

#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
using namespace std; int main()
{
int N;
scanf("%d", &N);
vector<string> vst(N);
for (int i = 0; i < N; i++)
{
cin>>vst[i];
}
string ans;
for (int j = 0; j < (int)vst[0].size(); j++)
{
bool allX = true;
char x = vst[0][j];
for (int i = 1; i < (int)vst.size(); i++)
{
if (x == '?')
{
x = vst[i][j];
}
else if (vst[i][j] != '?' && vst[i][j] != x)
{
allX = false;
x = '?';
break;
}
}
if (allX && x == '?') ans.push_back('x');//全是?号
//else if (allX && x != '?') ans.push_back(x);//仅仅有一个不是?号
else ans.push_back(x);//超过一个不是?号,和上面情况合并了
}
cout<<ans;
return 0;
}

版权声明:笔者靖心脏。景空间地址:http://blog.csdn.net/kenden23/,只有经过作者同意转载。

Codeforces C. Pattern 412 解决问题的方法的更多相关文章

  1. python正则表达式基础,以及pattern.match(),re.match(),pattern.search(),re.search()方法的使用和区别

    正则表达式(regular expression)是一个特殊的字符序列,描述了一种字符串匹配的模式,可以用来检查一个字符串是否含有某种子字符串. 将匹配的子字符串替换或者从某个字符串中取出符合某个条件 ...

  2. 解决问题的方法=>现象-->原因-->方案-->方案的优缺点

    解决问题的方法=>现象-->原因-->方案-->方案的优缺点

  3. Java中Pattern类的quote方法将任何字符串(包括正则表达式)都转换成字符串常量,不具有任何匹配功能

    Java中Pattern类的quote方法将任何字符串(包括正则表达式)都转换成字符串常量,不具有任何匹配功能. 下面是个例子: import org.junit.Test; import java. ...

  4. 访问 IIS 元数据库失败解决问题的方法

    近日调试一Asp.net程序,出现了“访问 IIS 元数据库失败”的错误信息,最后经过搜索发现了解决问题的方法. 解决方法如下: 1.依次点击“开始”-“运行”. 2.在“运行”栏内输入 “C:\WI ...

  5. Selenium私房菜系列10 -- 我遇到的问题及解决问题的方法

    Selenium私房菜系列10 -- 我遇到的问题及解决问题的方法

  6. Selenium私房菜系列9 -- 我遇到的问题及解决问题的方法

    Selenium私房菜系列10 -- 我遇到的问题及解决问题的方法

  7. Codeforces Round #248 (Div. 2) (ABCD解决问题的方法)

    比赛链接:http://codeforces.com/contest/433 A. Kitahara Haruki's Gift time limit per test:1 second memory ...

  8. NOIP 2012 解决问题的方法

    [D1T1vigenerepassword] P1778vigenerepassword Accepted 标签:[显示标签] 描写叙述 16世纪法国外交家Blaise de Vigenère设计了一 ...

  9. POJ 3450 Corporate Identity KMP解决问题的方法

    这个问题,需要一组字符串求最长公共子,其实灵活运用KMP高速寻求最长前缀. 请注意,意大利愿父亲:按照输出词典的顺序的规定. 另外要提醒的是:它也被用来KMP为了解决这个问题,但是很多人认为KMP使用 ...

随机推荐

  1. Haproxy 为 mysql 做负载均衡

    .tar.gz cd haproxy- uname -r vim /etc/haproxy.cfg global #日志 log 127.0.0.1 local0 maxconn chroot /tm ...

  2. DC中检查脚本错误

    dcprocheck    +     要检查的tcl文件

  3. android开发-获取wifi列表

    近期博主在学frangment框架,因此想着想着就想通过listfragment完毕对wifi列表的获取. 好! 如今就不说废话了. 一.wifi的基础知识 在Android的官方文档中定义了例如以下 ...

  4. ping 本地端口

    C:\Users\Administrator>netstat -ano | findstr 8001

  5. [Node] Catch error for async await

    When we try to do MongoDB opration, mongoose return Promise, we can use async/await to simply the co ...

  6. STATUS CODE: 91, occurs when trying to move media from one volume pool to another.

    Overview:Symantec NetBackup (tm) will not allow a tape with active images to be moved from one volum ...

  7. Chinese remainder theorem

    https://en.wikipedia.org/wiki/Chinese_remainder_theorem http://planetmath.org/ChineseRemainderTheore ...

  8. 最简单的基于FFmpeg的移动端样例:IOS HelloWorld

    ===================================================== 最简单的基于FFmpeg的移动端样例系列文章列表: 最简单的基于FFmpeg的移动端样例:A ...

  9. 仿凤凰时时彩代购平台源代码[ASP+MSSQL]完整下载

    源代码简单介绍 : 适用范围:  时时彩源代码,时时彩程序,开奖平台源代码,投注平台源代码,仿凤凰时时彩源代码 执行环境:  ASP+MSSQL 其它说明:仿凤凰时时彩代购平台源代码.网上售价8000 ...

  10. iOS开发之Quartz2D 五:UIKIT 绘图演练,画文字,画图片

    #import "DrawView.h" @implementation DrawView -(void)awakeFromNib { // //画图片 // UIImage *i ...