SHARE
TWEET

Untitled

a guest Jun 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2.  
  3. if __name__=="__main__":
  4.     T = input()
  5.     for _ in xrange(T):
  6.         N, M, r0, c0, r, c, A, B = map(int,raw_input().split())
  7.         i,j = divmod(abs(r-r0), A)
  8.         k,l = divmod(abs(c-c0), B)
  9.         r=i+k
  10.         if j: r+=1
  11.         if l: r+=1
  12.         print r
RAW Paste Data
Top