Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define ll long long
- #define ull unsigned long long
- #define pi 3.141592654
- #define NUM 1e18
- #define Mod 1'000'000'007
- #define fixed(n) fixed<<setprecision(n)
- #define cin(v) for(auto &i:v) cin >> i ;
- #define cout(v) for(auto &i:v) cout << i <<" ";
- #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
- #define small(x) (x>=97&&x<=122)
- #define capital(x) (x>=65&&x<=90)
- #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
- #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
- #define all(v) ((v).begin()), ((v).end())
- #define allr(v) ((v).rbegin()), ((v).rend())
- #define updmax(a,b) a=max(a,b)
- #define updmin(a,b) a=min(a,b)
- #define ceil(a,b) ((a/b)+(a%b?1:0))
- /* asc -> 1 2 3 ,des -> 3 2 1 */
- /***********************************************************************************/
- using namespace std;
- void Rofyda_Elghadban(){
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- }
- void solve(){
- int t;
- cin>>t;
- while(t--){
- char arr[10][10];
- int ans=0,c1=0,c2=0,c3=0,c4=0,c5=0;
- for(int i=0;i<10;i++){
- for(int j=0;j<10;j++){
- cin>>arr[i][j];
- }
- }
- for(int i=0;i<10;i++){
- for(int j=0;j<10;j++){
- if((i==0&&j==0)||(i==0&&j==1)||(i==0&&j==2)||(i==0&&j==3)||(i==0&&j==4)||(i==0&&j==5)
- ||(i==0&&j==6)||(i==0&&j==7)||(i==0&&j==8)||(i==0&&j==9)||(i==1&&j==0)||(i==2&&j==0)
- ||(i==3&&j==0)||(i==4&&j==0)||(i==5&&j==0)||(i==6&&j==0)||(i==7&&j==0)||(i==8&&j==0)
- ||(i==9&&j==0)||(i==9&&j==1)||(i==9&&j==2)||(i==9&&j==3)||(i==9&&j==4)||(i==9&&j==5)
- ||(i==9&&j==6)||(i==9&&j==7)||(i==9&&j==8)||(i==9&&j==9)||(i==1&&j==9)||(i==2&&j==9)
- ||(i==3&&j==9)||(i==4&&j==9)||(i==5&&j==9)||(i==6&&j==9)||(i==7&&j==9)||(i==8&&j==9)){
- if(arr[i][j]=='X'){
- c1++;
- }else{
- continue;
- }
- }
- else if((i==1&&j==1)||(i==1&&j==2)||(i==1&&j==3)||(i==1&&j==4)||(i==1&&j==5)
- ||(i==1&&j==6)||(i==1&&j==7)||(i==1&&j==8)||(i==2&&j==1)||(i==3&&j==1)
- ||(i==4&&j==1)||(i==5&&j==1)||(i==6&&j==1)||(i==7&&j==1)||(i==8&&j==1)
- ||(i==8&&j==2)||(i==8&&j==3)||(i==8&&j==4)||(i==8&&j==5)||(i==8&&j==6)
- ||(i==8&&j==7)||(i==8&&j==8)||(i==2&&j==8)||(i==3&&j==8)||(i==4&&j==8)
- ||(i==5&&j==8)||(i==6&&j==8)||(i==7&&j==8)){
- if(arr[i][j]=='X'){
- c2++;
- }else{
- continue;
- }
- }
- else if((i==2&&j==2)||(i==2&&j==3)||(i==2&&j==4)||(i==2&&j==5)||(i==2&&j==6)
- ||(i==2&&j==7)||(i==3&&j==2)||(i==4&&j==2)||(i==5&&j==2)||(i==6&&j==2)
- ||(i==7&&j==2)||(i==7&&j==3)||(i==7&&j==4)||(i==7&&j==5)||(i==7&&j==6)
- ||(i==7&&j==7)||(i==3&&j==7)||(i==4&&j==7)||(i==5&&j==7)||(i==6&&j==7)){
- if(arr[i][j]=='X'){
- c3++;
- }else{
- continue;
- }
- }
- else if((i==3&&j==3)||(i==3&&j==4)||(i==3&&j==5)||(i==3&&j==6)||(i==4&&j==3)
- ||(i==5&&j==3)||(i==6&&j==3)||(i==6&&j==4)||(i==6&&j==5)||(i==6&&j==6)
- ||(i==4&&j==6)||(i==5&&j==6)){
- if(arr[i][j]=='X'){
- c4++;
- }else{
- continue;
- }
- }
- else if((i==4&&j==4)||(i==4&&j==5)||(i==5&&j==4)||(i==5&&j==5)){
- if(arr[i][j]=='X'){
- c5++;
- }else{
- continue;
- }
- }
- }
- }
- ans=(c1*1)+(c2*2)+(c3*3)+(c4*4)+(c5*5);
- cout<<ans<<"\n";
- }
- }
- int main(){
- Rofyda_Elghadban();
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment