Ada King Problem Code: ADAKING COdechef Solution

 #include <bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin>>t;
  while(t--){
    int k;
    cin>>k;
    int rows=(k-1)/8;
    int cols=(k-1)%8;
    for(int i=0;i<rows;i++){
      cout<<"........\n";
    }
    for(int i=0;i<cols;i++){
      cout<<'.';
    }
    cout<<'O';
    while(cols+1<8)cout<<'X',cols++;
    cout<<'\n';
    while(rows+1<8)cout<<"XXXXXXXX\n",rows++;
  }
}

Comments