解題說明
C++ 解法
複雜度分析
虛擬碼
1. Compute g = gcd(p, q) 2. Reduce: p = p / g, q = q / g 3. Now p and q are coprime 4. If p is odd and q is odd: return 1 (northeast corner) 5. If p is odd and q is even: return 0 (southeast corner) 6. If p is even and q is odd: return 2 (northwest corner) (p even and q even is impossible since they are coprime)