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

  • 每次碰到模拟都要跪几发 +.+

  • 首先拨号数字至少要是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;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值