fork download
  1. def parse(inFile):
  2. return tuple(inFile.getInts())
  3.  
  4. def rotate(n, k):
  5. v = str(n)
  6. v = "0" * (k - len(v)) + v
  7. return int(v[1:]+v[0])
  8.  
  9. def solve((A,B)):
  10. k = len(str(A))
  11. count = 0
  12. for n in xrange(A, B):
  13. m = rotate(n, k)
  14. while (m != n):
  15. if (n < m) and (m <= B):
  16. count += 1
  17. m = rotate(m, k)
  18. return count
  19.  
  20. if __name__ == "__main__":
  21. from GCJ import GCJ
  22. GCJ(parse, solve, "/Users/lpebody/gcj/2012_q/", "c").run()
  23.  
  24.  
  25.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty