Ad Code

Responsive Advertisement

278 - Chess

Author: Ismail Hosen

Daffodil International University





Problem Link

//Please follow from main function



#include<bits/stdc++.h>
using namespace std;
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
int a, b, c, d, m, n;
char ch;
cin>>a;
while(a--){
cin>>ch>>n>>m;
if(ch=='r' || ch=='Q')c=min(n,m);
else if(ch=='k')c=((n+1)/2)*((m+1)/2) + ((n/2)*(m/2));
else c=((n+1)/2)*((m+1)/2);
cout<<c<<endl;
}
return 0;
}
view raw 278 - Chess.cpp hosted with ❤ by GitHub

Post a Comment

0 Comments