【枚举】URAL - 2081 - Faulty dial
//._. ... ._. ._. ... ._. ._. ._. ._. ._.
//|.| ..| ._| ._| |_| |_. |_. ..| |_| |_|
//|_| ..| |_. ._| ..| ._| |_| ..| |_| ._|
#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的更多相关文章
- URAL 2081 Faulty dial
题目: Faulty dial Pavel has not played ACM for ages, nor does he train teams, nor prepare problems. Th ...
- URAL 2078~2089
URAL 2078~2089 A - Bowling game 题目描述:给出保龄球每一局击倒的球数,按照保龄球的规则,算出总得分的最小值和最大值. solution 首先是最小值:每一局第一球击倒\ ...
- URAL 1792. Hamming Code (枚举)
1792. Hamming Code Time limit: 1.0 second Memory limit: 64 MB Let us consider four disks intersectin ...
- URAL 2031. Overturned Numbers (枚举)
2031. Overturned Numbers Time limit: 1.0 second Memory limit: 64 MB Little Pierre was surfing the In ...
- URAL 1200 Horns and Hoofs 枚举
设horns和hoofs的数量分别为 x 和 y ,题目要求: 满足 x+y <= K,使得A*x + B*y - x*x - y*y 最大. 枚举 i 从0~K,直接解方程得对称轴 x = ( ...
- 【折半枚举】Ural Championship April 30, 2017 Problem G. Glasses with solutions
题意:有n杯盐溶液,给定每杯里面盐的质量以及盐溶液的质量.问你有多少种方案选择一个子集,使得集合里面的盐溶液倒到一个被子里面以后,浓度为A/B. 折半枚举,暴力搜索分界线一侧的答案数,跨越分界线的答案 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
随机推荐
- HDU 多校对抗赛第二场 1004 Game
Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- mysql的对象
mysql 常见的数据对象有哪些: DataBase/Schema Table Index View/Trigger/Function/Procedure 多Database用途: 业务的隔离 ...
- shell监控进程是否存在
1.直接给代码:我这个是两个程序.多半要写成函数 [root@java1 src]# cat checkprocess.sh #!/bin/bashcheckprocess(){ps -ef|grep ...
- fs.watch 爬坑
上星期用 fs.watch 和 readline.createInterface 对pm2的合并日志做了监控,根据指定的错误信息重启服务 发现不管是手动vim编辑日志,还是等待日志自动输出. fs.w ...
- CSS三大特性(继承、优先级、层叠)之个人见解
首先声明一下CSS三大特性——继承.优先级和层叠.继承即子类元素继承父类的样式,比如font-size,font-weight等f开头的css样式以及text-align,text-indent等t开 ...
- Python基础(9)三元表达式、列表解析、生成器表达式
一.三元表达式 三元运算,是对简单的条件语句的缩写. # if条件语句 if x > f: print(x) else: print(y) # 条件成立左边,不成立右边 x if x > ...
- 安装l Xposed Framework
How to install Xposed Framework on Android 4.x.x : 1. For Android 4.0.3 through 4.4.4 Visit this X ...
- Chrome Capabilities & ChromeOptions
Capabilities & ChromeOptions Chrome Extensions Contributing Downloads Getting started Android Ch ...
- SpringMvc基础知识(一)
目录: springmvc框架原理(掌握) 前端控制器.处理器映射器.处理器适配器.视图解析器 springmvc入门程序 目的:对前端控制器.处理器映射器.处理器适配器.视图解析器学习 非注解的处理 ...
- HDU1281(二分图最大匹配,棋盘建图,找关键点)
棋盘游戏 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submis ...