Wednesday, August 10, 2016

Codeforces 689A - Mike and Cellphone

Unknown
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int n,l,r,u,d;
    l=r=u=d=0;
    scanf("%d",&n);
    getchar();
    char s[11];
    scanf("%s",s);
    for (int i=0;i<n;i++){
        int a=s[i]-'0';
        if (a==1 || a==4||a==7||a==0) l=1;
        if (a==3 || a==6||a==9||a==0) r=1;
        if (a==1 || a==2||a==3) u=1;
        if (a==7 || a==0||a==9) d=1;
    }
    if (l && r && u && d) printf("YES\n");
    else printf("NO\n");
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,