Thursday, September 1, 2016

UVa - 11044 - Searching for Nessy

Problem link:
11044 - Searching for Nessy

Solution:
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. const int S = 300003;
  5. const int MOD = 1e9+7;
  6. const double pi = 2 * acos (0.0);
  7. int _I(){int x; scanf("%d"&x); return x;}
  8. LL _LL(){LL x; scanf("%lld"&x); return x;}
  9. int dirX[]={10-101-11-1};
  10. int dirY[]={010-11-1-11};
  11. int rX[] = {1122-1-1-2-2};
  12. int rY[] = {2-21-12-21-1};
  13.  
  14. template <class T> T Distance(T x1, T y1, T x2, T y2){return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));};
  15.  
  16. int sset(int N, int pos){return N=N|(1<<pos);}
  17. bool check(int N, int pos){return (bool)(N&(1<<pos));}
  18. int reset(int N, int pos){return N=N&~(1<<pos);}
  19. ///...............Code Starts From Here...............///
  20.  
  21. int main(){
  22.     int t = _I();
  23.     while(t--){
  24.         int n = _I(), m = _I();
  25.         n /= 3;
  26.         m /= 3;
  27.         n *= m;
  28.         printf("%d\n", n);
  29.     }
  30.     return 0;
  31. }

No comments:

Post a Comment