Solution – 330A – Cakeminator – codeforces

April 8, 2016 § Leave a comment

//c++
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int r,c;
    cin>>r>>c;
    char arr[11][11];
    for(int i=0 ; i<r ; i++)
    {
        for(int j=0 ; j<c ; j++)         {             cin>>arr[i][j];
        }
    }
    int co=0; //how many dots
    int res1=0; //1stpart
    int re=0; //how many repeat
    for(int i=0 ; i<r ; i++)
    {
        co=0;
        bool repeat=false; //repeat or not
        for(int j=0 ; j<c ; j++)
        {
            if(arr[i][j]=='.')
                {co++;}
        }

        if(co==c && repeat==true)
            {res1=co-1+res1; repeat=true; re++;}
        else if(co==c)
            {res1=co+res1; repeat=true; re++;}
    }
    int res=0; //2ndpart
    for(int i=0 ; i<c ; i++)
    {
        co=0;
        bool repeat=false; //repeat or not
        for(int j=0 ; j<r ; j++)
        {
            if(arr[j][i]=='.')
                co++;
        }
        if(co==r)
            {res=co-re+res; repeat=true;}
    }
    cout<<res+res1;
}

Find more from my submissions HERE

Advertisements

Tagged: , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Solution – 330A – Cakeminator – codeforces at Orange Notes.

meta

%d bloggers like this: