artemgf

Юный гроссмейстер Саша

May 7th, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. #define _USE_MATH_DEFINES
  2. #include <iostream>
  3. #include <conio.h>
  4. #include <string>
  5. #include <set>
  6. #include <map>
  7. #include <algorithm>
  8. #include <string>
  9. #include <math.h>
  10. #include <vector>
  11. #include <cmath>
  12. #include <sstream>
  13.  
  14. using namespace std;
  15.  
  16. int main()
  17. {
  18.     long long n, x, y, sc = 0, promx, promy;
  19.    
  20.     cin >> n >> x >> y;
  21.  
  22.     sc = 0;
  23.     {
  24.         if (x != n&&x != 1)
  25.             if (y != n&&y != 1)
  26.                 sc += 8;
  27.             else
  28.                 if (y != n || y != 1)
  29.                     sc += 5;
  30.                 else
  31.                     sc += 2;
  32.         else
  33.             if (x != n || x != 1)
  34.             {
  35.                 if (y != n&&y != 1)
  36.                     sc += 5;
  37.                 else
  38.                     if (y != n || y != 1)
  39.                         sc += 3;
  40.                     else
  41.                         sc += 1;
  42.             }
  43.             else
  44.             {
  45.                 if (y != n&&y != 1)
  46.                     sc += 2;
  47.                 else
  48.                     if (y != n || y != 1)
  49.                         sc += 1;
  50.             }
  51.     }
  52.  
  53.     cout << "King: " << sc << endl;
  54.     sc = 0;
  55.     {
  56.         if (x + 2 <= n)
  57.             if (y + 1 <= n && y - 1 >= 1)
  58.                 sc = sc + 2;
  59.             else
  60.                 sc = sc + 1;
  61.  
  62.         if (x - 2 >= 1)
  63.             if (y + 1 <= n && y - 1 >= 1)
  64.                 sc = sc + 2;
  65.             else
  66.                 sc = sc + 1;
  67.  
  68.         if (y - 2 >= 1)
  69.             if (x + 1 <= n && x - 1 >= 1)
  70.                 sc = sc + 2;
  71.             else
  72.                 sc = sc + 1;
  73.  
  74.         if (y + 2 <= n)
  75.             if (x + 1 <= n && x - 1 >= 1)
  76.                 sc = sc + 2;
  77.             else
  78.                 sc = sc + 1;
  79.     }
  80.  
  81.     cout << "Knight: " << sc << endl;
  82.  
  83.     sc = 0;
  84.  
  85.     if (x - 1 < y - 1)
  86.         sc += x - 1;
  87.     else
  88.         sc += y - 1;
  89.     if (x - 1 < n-y)
  90.         sc += x - 1;
  91.     else
  92.         sc += n - y;
  93.     if (n-x < y - 1)
  94.         sc += n-x;
  95.     else
  96.         sc += y - 1;
  97.     if (n - x < n - y)
  98.         sc += n - x;
  99.     else
  100.         sc += n - y;
  101.    
  102.     cout << "Bishop: " << sc << endl;
  103.  
  104.     cout << "Rook: " << n * 2 - 2 << endl;
  105.  
  106.     cout << "Queen: " << (n * 2 - 2) + sc << endl;
  107.  
  108.     return 0;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment