898 c
unknown
plain_text
2 years ago
1.8 kB
12
Indexable
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define all(v) v.begin(),v.end()
#define Max 1000000000000000014
#define Min -1000000000000000014
#define pb push_back
#define PI 3.1415926535897
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
int main()
{
optimize();
int t;
cin>>t;
while(t--)
{
int sum=0;
string s[10];
for(int i=0; i<10; i++)
{
for(int j=0; j<10; j++)
cin>>s[i][j];
}
for(int i=0; i<10; i++)
{
for(int j=0; j<10; j++)
{
if(i==0 || i==9 || j==0 || j==9)
{
if(s[i][j]=='X')
sum+=1;
}
else if((i<9 && (j==1 || j==8))|| ((i==1 || i==8 ) && j<9))
{
if(s[i][j]=='X')
sum+=2;
}
else if((i<8 &&(j==3 || j==7))|| ((i==2 || i==7)&&j<8))
{
if(s[i][j]=='X')
sum+=3;
}
else if((i<7 &&(j==3 || j==6)) || ((i==3 || i==6)&& j<7))
{
if(s[i][j]=='X')
sum+=4;
}
else
{
if(s[i][j]=='X')
sum+=5;
}
}
}
cout << sum <<endl;
}
return 0;
}
Editor is loading...