Accepted solution

UVA 12405 - Scarecrow

Open original problem
Source code

#include <iostream>

#include<vector>

#include<stdio.h>

using namespace std;

int main() {

int  t,t1;

    char c[500];

    int count=0;

    int total=0;

cin>>t;

for(int i=0;i<t;i++)

    {

        cin>>t1>>c;

       for(int j=0;j<t1;)

        {

            if(c[j] == '#')

            {

             j++;

            }

            else if(c[j] == '.')

            {

              total++;

              j += 3;

            }

        }

        cout<<"Case "<<i+1<<": "<<total<<endl;

        total=0;

    }

return 0;

}
Join the discussion

Add your comment