Advertisement
juanjo12x

UVA_278_Chess

Jul 26th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <cctype>
  7. #include <stack>
  8. #include <queue>
  9. #include <list>
  10. #include <vector>
  11. #include <map>
  12. #include <set>
  13. #define N 1000000
  14. #define LL unsigned long long
  15. using namespace std;
  16.  
  17. int main() {
  18.     int t,fil,col,prod ;
  19.     char piece;
  20.  scanf("%d",&t);
  21.  while(t--){
  22.     cin>>piece>>fil>>col;
  23.     if(piece=='r'){
  24.         printf("%d\n",fil);
  25.     }else if(piece=='Q'){
  26.         printf("%d\n",fil);
  27.     }else if(piece=='k'){
  28.         prod=fil*col/2;
  29.         if ((fil%2!=0) && (col%2!=0)){
  30.            
  31.             prod++;
  32.         }
  33.        
  34.         printf("%d\n",prod);
  35.     }else {
  36.         if (fil%2!=0) fil++;
  37.        if(col%2!=0) col++;
  38.        printf("%d\n",fil*col/4);
  39.     }
  40.        
  41.  }
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement