Rofyda_Elghadban1

Untitled

Sep 22nd, 2023
1,062
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.69 KB | None | 0 0
  1.  #include <bits/stdc++.h>
  2.  #define ll long long
  3.  #define ull unsigned long long
  4.  #define pi 3.141592654
  5.  #define NUM 1e18
  6.  #define Mod  1'000'000'007
  7.  #define fixed(n) fixed<<setprecision(n)
  8.  #define cin(v) for(auto &i:v) cin >> i ;
  9.  #define cout(v) for(auto &i:v) cout << i  <<" ";
  10.  #define vowel(x) (x=='e'||x=='a'||x=='i'||x=='o'||x=='u')
  11.  #define small(x) (x>=97&&x<=122)
  12.  #define capital(x) (x>=65&&x<=90)
  13.  #define Tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
  14.  #define Toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
  15.  #define all(v) ((v).begin()), ((v).end())
  16.  #define allr(v) ((v).rbegin()), ((v).rend())
  17.  #define updmax(a,b) a=max(a,b)
  18.  #define updmin(a,b) a=min(a,b)
  19.  #define ceil(a,b) ((a/b)+(a%b?1:0))
  20.  /* asc -> 1 2 3 ,des -> 3 2 1 */
  21.  /***********************************************************************************/
  22.  using namespace std;
  23.  void Rofyda_Elghadban(){
  24.   #ifndef ONLINE_JUDGE  
  25.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  26.    #endif
  27.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  28.  }
  29.  
  30.  void solve(){
  31.   int t;
  32.   cin>>t;
  33.   while(t--){
  34.     char arr[10][10];
  35.     int ans=0,c1=0,c2=0,c3=0,c4=0,c5=0;
  36.     for(int i=0;i<10;i++){
  37.       for(int j=0;j<10;j++){
  38.         cin>>arr[i][j];
  39.       }
  40.     }
  41.     for(int i=0;i<10;i++){
  42.       for(int j=0;j<10;j++){
  43.         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)
  44.         ||(i==0&&j==6)||(i==0&&j==7)||(i==0&&j==8)||(i==0&&j==9)||(i==1&&j==0)||(i==2&&j==0)
  45.         ||(i==3&&j==0)||(i==4&&j==0)||(i==5&&j==0)||(i==6&&j==0)||(i==7&&j==0)||(i==8&&j==0)
  46.         ||(i==9&&j==0)||(i==9&&j==1)||(i==9&&j==2)||(i==9&&j==3)||(i==9&&j==4)||(i==9&&j==5)
  47.         ||(i==9&&j==6)||(i==9&&j==7)||(i==9&&j==8)||(i==9&&j==9)||(i==1&&j==9)||(i==2&&j==9)
  48.         ||(i==3&&j==9)||(i==4&&j==9)||(i==5&&j==9)||(i==6&&j==9)||(i==7&&j==9)||(i==8&&j==9)){
  49.           if(arr[i][j]=='X'){
  50.             c1++;
  51.           }else{
  52.             continue;
  53.           }
  54.         }
  55.         else if((i==1&&j==1)||(i==1&&j==2)||(i==1&&j==3)||(i==1&&j==4)||(i==1&&j==5)
  56.         ||(i==1&&j==6)||(i==1&&j==7)||(i==1&&j==8)||(i==2&&j==1)||(i==3&&j==1)
  57.         ||(i==4&&j==1)||(i==5&&j==1)||(i==6&&j==1)||(i==7&&j==1)||(i==8&&j==1)
  58.         ||(i==8&&j==2)||(i==8&&j==3)||(i==8&&j==4)||(i==8&&j==5)||(i==8&&j==6)
  59.         ||(i==8&&j==7)||(i==8&&j==8)||(i==2&&j==8)||(i==3&&j==8)||(i==4&&j==8)
  60.         ||(i==5&&j==8)||(i==6&&j==8)||(i==7&&j==8)){
  61.           if(arr[i][j]=='X'){
  62.             c2++;
  63.           }else{
  64.             continue;
  65.           }
  66.         }
  67.         else if((i==2&&j==2)||(i==2&&j==3)||(i==2&&j==4)||(i==2&&j==5)||(i==2&&j==6)
  68.         ||(i==2&&j==7)||(i==3&&j==2)||(i==4&&j==2)||(i==5&&j==2)||(i==6&&j==2)
  69.         ||(i==7&&j==2)||(i==7&&j==3)||(i==7&&j==4)||(i==7&&j==5)||(i==7&&j==6)
  70.         ||(i==7&&j==7)||(i==3&&j==7)||(i==4&&j==7)||(i==5&&j==7)||(i==6&&j==7)){
  71.           if(arr[i][j]=='X'){
  72.             c3++;
  73.           }else{
  74.             continue;
  75.           }
  76.         }
  77.         else if((i==3&&j==3)||(i==3&&j==4)||(i==3&&j==5)||(i==3&&j==6)||(i==4&&j==3)
  78.         ||(i==5&&j==3)||(i==6&&j==3)||(i==6&&j==4)||(i==6&&j==5)||(i==6&&j==6)
  79.         ||(i==4&&j==6)||(i==5&&j==6)){
  80.           if(arr[i][j]=='X'){
  81.             c4++;
  82.           }else{
  83.             continue;
  84.           }
  85.         }
  86.         else if((i==4&&j==4)||(i==4&&j==5)||(i==5&&j==4)||(i==5&&j==5)){
  87.           if(arr[i][j]=='X'){
  88.             c5++;
  89.           }else{
  90.             continue;
  91.           }
  92.         }
  93.       }
  94.     }
  95.     ans=(c1*1)+(c2*2)+(c3*3)+(c4*4)+(c5*5);
  96.     cout<<ans<<"\n";
  97.   }
  98.  }
  99.  
  100.  int main(){
  101.   Rofyda_Elghadban();
  102.   solve();
  103.  
  104.   return 0;
  105.  }
  106.  
Advertisement
Add Comment
Please, Sign In to add comment