您的位置:首页 > 其它

CF Round #361 (Div. 2) 689A 模拟

2016-07-14 09:17 211 查看
每次碰到模拟都要跪几发 +.+

首先拨号数字至少要是3*3 或者 k*4 才能保证其初步的单一性

有一个坑没有想到的是 3*3中第三行是0或者8,坑了一发

上代码

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#define INF 0x3fffffff
using namespace std;
typedef long long ll;
const int MAX_N = 500+10;

char num[12];
int xx[12];

int main()
{
int x[12] = {2,1,2,3,1,2,3,1,2,3};
int y[12] = {4,1,1,1,2,2,2,3,3,3};
int n;
while(scanf("%d",&n)!=EOF)
{
int t;
int l=3;
int r=1;
int h=1;
int s=4;
scanf("%s",num);
memset(xx,0,sizeof(xx));
for(int i=0;i<n;i++)
{
t = num[i] - '0';
xx[t]=1;
l = min(l,x[t]);
r = max(r,x[t]);
h = max(h,y[t]);
s = min(s,y[t]);
}
int ans = (r-l+1) * (h-s+1);
if((h-s+1)==4)
ans = 16;
if(ans==9&&xx[8]==1&&(xx[0]+xx[9]+xx[7])==0)
{
ans=0;
}
if(ans==9&&xx[0]==1)
ans=0;
if(ans > 6)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces 模拟