About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

রবিবার, ৫ জুলাই, ২০১৫

UVA 11244 - Counting Stars solution

#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define pi acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int>vc;

int xr[]= {-1,-1,-1,0,0,1,1,1};
int yc[]= {-1,0,1,-1,1,-1,0,1};

int row,col;
char str[102][102];
//bool visit[102][102];

int main()
{
  //  freopen("in.txt","r",stdin);
    while(~scd(row,col))
    {
        if(row==0&&col==0) break;
       // memset(visit,0,sizeof(visit));
        for(int i=0; i<row; i++) cin>>str[i];
        int cnt=0;
        for(int i=0; i<row; i++)
        {
            for(int j=0; j<col; j++)
            {
                bool flag=false;
                if(str[i][j]=='*')
                {

                    for(int k=0; k<8; k++)
                    {
                        if(((i+xr[k])>=0&&(i+xr[k])<row)&&((j+yc[k])>=0&&(j+yc[k])<col))
                        {
                            int R=i+xr[k];
                            int C=j+yc[k];
                            if(str[R][C]=='*') flag=true;

                        }

                    }
                    if(flag==false) cnt++;

                }


            }


        }

        printf("%d\n",cnt);

    }

    return 0;
}











কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন