//._. ... ._. ._. ... ._. ._. ._. ._. ._.
//|.| ..| ._| ._| |_| |_. |_. ..| |_| |_|
//|_| ..| |_. ._| ..| ._| |_| ..| |_| ._|
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef pair<int,int> Point;
char table[10][3][4]={
{
"._.",
"|.|",
"|_|"
},
{
"...",
"..|",
"..|"
},
{
"._.",
"._|",
"|_."
},
{
"._.",
"._|",
"._|"
},
{
"...",
"|_|",
"..|"
},
{
"._.",
"|_.",
"._|"
},
{
"._.",
"|_.",
"|_|"
},
{
"._.",
"..|",
"..|"
},
{
"._.",
"|_|",
"|_|"
},
{
"._.",
"|_|",
"._|"
}
};
char b[3][30];
bool cant[5][10];
int l[5],r[5],n;
int main()
{
//freopen("d.in","r",stdin);
l[1]=0; r[1]=2;
l[2]=4; r[2]=6;
l[3]=10; r[3]=12;
l[4]=14; r[4]=16;
scanf("%d",&n);
Point Pre;
for(int i=1;i<=n;++i)
{
memset(cant,0,sizeof(cant));
for(int j=0;j<3;++j)
scanf("%s",b[j]);
for(int j=1;j<=4;++j)
{
for(int p=0;p<10;++p){
for(int k=0;k<3;++k)
for(int l1=0,l2=l[j];l1<3;++l1,++l2)
if(table[p][k][l1]=='.' && b[k][l2]!='.')
{
cant[j][p]=1;
goto OUT;
}
OUT:;
}
}
for(int j=9;j>=0;--j)
for(int k=9;k>=0;--k)
for(int l=9;l>=0;--l)
for(int p=9;p>=0;--p)
if((!cant[1][j]) && (!cant[2][k]) && (!cant[3][l]) && (!cant[4][p]) && (j<6 && l<6))
if(i==1 || Point(j*10+k,l*10+p)<Pre)
{
printf("%d%d:%d%d\n",j,k,l,p);
Pre=Point(j*10+k,l*10+p);
goto OU2;
}
OU2:;
}
return 0;
}

【枚举】URAL - 2081 - Faulty dial的更多相关文章

  1. URAL 2081 Faulty dial

    题目: Faulty dial Pavel has not played ACM for ages, nor does he train teams, nor prepare problems. Th ...

  2. URAL 2078~2089

    URAL 2078~2089 A - Bowling game 题目描述:给出保龄球每一局击倒的球数,按照保龄球的规则,算出总得分的最小值和最大值. solution 首先是最小值:每一局第一球击倒\ ...

  3. URAL 1792. Hamming Code (枚举)

    1792. Hamming Code Time limit: 1.0 second Memory limit: 64 MB Let us consider four disks intersectin ...

  4. URAL 2031. Overturned Numbers (枚举)

    2031. Overturned Numbers Time limit: 1.0 second Memory limit: 64 MB Little Pierre was surfing the In ...

  5. URAL 1200 Horns and Hoofs 枚举

    设horns和hoofs的数量分别为 x 和 y ,题目要求: 满足 x+y <= K,使得A*x + B*y - x*x - y*y 最大. 枚举 i 从0~K,直接解方程得对称轴 x = ( ...

  6. 【折半枚举】Ural Championship April 30, 2017 Problem G. Glasses with solutions

    题意:有n杯盐溶液,给定每杯里面盐的质量以及盐溶液的质量.问你有多少种方案选择一个子集,使得集合里面的盐溶液倒到一个被子里面以后,浓度为A/B. 折半枚举,暴力搜索分界线一侧的答案数,跨越分界线的答案 ...

  7. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  8. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  9. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

随机推荐

  1. [hdu 2298] 物理推导+二分答案

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2298 #include<bits/stdc++.h> using namespace st ...

  2. ntpq –p命令

    ntpq用来监视ntpd操作,ntpq -p查询网络中的NTP服务器,同时显示客户端和每个服务器的关系 [root@ ~]# ntpq -p remote refid st t when poll r ...

  3. java消息中间件入门

    消息中间件来解耦服务调用 比如1个登录系统,登录的话需要调用很多系统的其他服务,如果中间调用失败,可能会导致登录信息一致无法返回,同时也增加了系统的耦合度.而用消息中间件的话,则是不发送服务到其他系统 ...

  4. Spring表达式语言之SpEL

    •Spring 表达式语言(简称SpEL):是一个支持运行时查询和操作对象图的强大的表达式语言. •语法类似于 EL:SpEL 使用 #{…} 作为定界符,所有在大框号中的字符都将被认为是 SpEL ...

  5. Go 实现 soundex 算法

    [转]http://www.syyong.com/Go/Go-implements-the-soundex-algorithm.html SOUNDEX 返回由四个字符组成的代码 (SOUNDEX) ...

  6. strcpy函数的实现【转】

    转自:http://www.cnblogs.com/chenyg32/p/3739564.html 已知strcpy函数的原型是: char *strcpy(char *dst, const char ...

  7. selenium与360极速浏览器driver配置

    1)下载浏览器对应的driver,浏览器版本与driver对应关系,网址:http://www.cnblogs.com/JHblogs/p/7699951.html:driver下载地址:http:/ ...

  8. swap增加

    #创建17G的文件dd if=/dev/zero of=/data/swap/swap-1 bs=1024 count=16255000#设置为swap分区/sbin/mkswap /data/swa ...

  9. SQL按多个字段排序时的实现规则

    1.在使用SQL中的ORDER BY按照表中的多个列对表做排序是,会按照第一个列的排序条件作为排序基准,当第一个列的值都相同时,才会按照后面的列的排序条件作为排序基准: 案例如下: 图一和图二展示的是 ...

  10. seleniumu 3.0复选框操作(定位一组元素)

    一般验证复选框是否可以选择点击常用到定位一组元素去循环遍历执行点击事件.但是有时候在不同的浏览器下可能会存在差异化的最终结果. 目前谷歌浏览器常常存在多次点击同一复选框,导致最终最后两项复选框均未被勾 ...