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 11470 - Square Sums 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;

bool visit[102][102];

int main()
{
    //freopen("in.txt","r",stdin);
    int ary[11][11];
    int n,cas=0;
    while(~sc(n))
    {
        if(n==0) break;
        memset(visit,0,sizeof(visit));
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<n; j++) sc(ary[i][j]);
        }
        int limit=n/2;
        if(n%2!=0) limit++;
        printf("Case %d: ",++cas);

        for(int k=0,x=n; k<limit; k++,x--)
        {
            int sum=0;
            memset(visit,0,sizeof(visit));
            for(int i=k; i<x; i++)
            {

                if(visit[k][i]==0) sum+=ary[k][i];
                visit[k][i]=1;
                if(visit[i][k]==0)  sum+=ary[i][k];
                visit[i][k]=1;
                if(visit[x-1][i]==0) sum+=ary[x-1][i];
                visit[x-1][i]=1;
                if(visit[i][x-1]==0) sum+=ary[i][x-1];
                visit[i][x-1]=1;

            }
            cout<<sum;
            if(k<limit-1) printf(" ");

        }
        cout<<endl;

    }

    return 0;
}











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

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