当前位置: 首页>>代码示例>>Python>>正文


Python Checker.checkRange方法代码示例

本文整理汇总了Python中checker.Checker.checkRange方法的典型用法代码示例。如果您正苦于以下问题:Python Checker.checkRange方法的具体用法?Python Checker.checkRange怎么用?Python Checker.checkRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在checker.Checker的用法示例。


在下文中一共展示了Checker.checkRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, N_MIN, N_MAX, 'N')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:10,代码来源:validator.py

示例2: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    coefficients = ch.readInts(4)
    if coefficients == [0, 0, 0, 0]:
      break
    for i in xrange(len(coefficients)):
      ch.checkRange(coefficients[i], MIN, MAX, chr(ord('A') + i))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:11,代码来源:validator.py

示例3: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    a, b = ch.readInts(2)
    if a == 0 and b == 0:
      break
    ch.checkRange(a, MIN, MAX, 'A')
    ch.checkRange(b, MIN, MAX, 'B')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:11,代码来源:validator.py

示例4: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    a = int(ch.readLine())
    if a == -1:
      break
    ch.checkRange(a, 0, 315, 'd')
    ch.check(a % 45 == 0, 'd is a multiple of 45')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:11,代码来源:validator.py

示例5: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    
    as_ = ch.readInts(n)
    for a in as_:
      ch.checkRange(a, MIN, A_MAX, 'A')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:14,代码来源:validator.py

示例6: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    l = ch.readInt()
    if l == 0:
      break
    ch.checkRange(l, L_MIN, L_MAX, 'L')

    s = ch.readString()
    ch.checkValidCharacter(s, '+-.')
    ch.checkRange(len(s), l, l, 'length of S')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:14,代码来源:validator.py

示例7: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, N_MIN, N_MAX, 'N')
    
    ts_ = ch.readInts(n)
    for t in ts_:
      ch.checkRange(t, T_MIN, T_MAX, 'T')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:14,代码来源:validator.py

示例8: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    
    for _ in xrange(n):
      s = ch.readString()
      ch.checkValidCharacter(s, string.ascii_uppercase)
      ch.checkLength(s, n, 'S', 'N')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:15,代码来源:validator.py

示例9: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n, p = ch.readInts(2)
    if n == 0 and p == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    ch.checkRange(p, MIN, P_MAX, 'P')
    
    ts = ch.readInts(n)
    for t in ts:
      ch.checkRange(t, MIN, T_MAX, 'T')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:15,代码来源:validator.py

示例10: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = ch.readInt()
    if n == 0:
      break
    ch.checkRange(n, MIN, N_MAX, 'N')
    
    for _ in xrange(n):
      d, l = ch.matchRegex(r'(\w) (\d)')
      l = int(l)
      ch.checkValidCharacter(d, 'LR')
      ch.checkRange(l, MIN, L_MAX, 'L')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:16,代码来源:validator.py

示例11: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    r, n = ch.readInts(2)
    if r == 0 and n == 0:
      break
    ch.checkRange(r, R_MIN, R_MAX, 'R')
    ch.checkRange(n, N_MIN, N_MAX, 'N')
    
    xs = ch.readInts(n)
    ch.checkSorted(xs, 'Xs')
    ch.checkUnique(xs, 'Xs')
    for x in xs:
      ch.checkRange(x, X_MIN, X_MAX, 'X')
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:17,代码来源:validator.py

示例12: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = int(ch.readLine())
    if n == 0:
      break
    ch.checkRange(n, 3, 50, 'n')
    ps = []
    for _ in range(n):
      x, y = [int(w) for w in ch.readLine().strip().split()]
      ch.check((x, y) not in ps, "no dup points: (%d, %d)" % (x, y))
      ch.checkRange(x, -500, 500, 'x')
      ch.checkRange(y, -500, 500, 'y')
      ps.append((x, y))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:17,代码来源:validator.py

示例13: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = int(ch.readLine())
    if n == 0:
      break
    ch.checkRange(n, 1, 5, 'n')
    ps = set()
    ps.add((0, 0))
    for _ in range(n):
      x, y = [int(w) for w in ch.readLine().strip().split()]
      ch.check((x, y) not in ps, "no dup points")
      ch.checkRange(x, -50, 50, 'x')
      ch.checkRange(y, -50, 50, 'y')
      ps.add((x, y))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:18,代码来源:validator.py

示例14: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n = int(ch.readLine())
    if n == -1:
      break
    ch.checkRange(n, 0, 23, 'n')
    ps = set()
    ps.add((1, 1))
    ps.add((5, 5))
    for _ in range(n):
      x, y = [int(w) for w in ch.readLine().strip().split()]
      ch.check((x, y) not in ps, 'no dup points')
      ch.checkRange(x, 1, 5, 'x')
      ch.checkRange(y, 1, 5, 'y')
      ps.add((x, y))
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:19,代码来源:validator.py

示例15: main

# 需要导入模块: from checker import Checker [as 别名]
# 或者: from checker.Checker import checkRange [as 别名]
def main():
  ch = Checker()

  while True:
    n, m = ch.matchRegex(r'(\d+) (\d+)')
    n = int(n)
    m = int(m)
    if n == 0:
      break

    ch.checkRange(n, N_MIN, N_MAX, 'N')
    ch.checkRange(m, M_MIN, min(n*n-n, M_MAX), 'M')
    
    edgeset = set()
    for _ in xrange(m):
      a, b = ch.matchRegex(r'(\d+) (\d+)')
      a = int(a)
      b = int(b)
      ch.checkRange(a, 1, n, 'A')
      ch.checkRange(b, 1, n, 'B')
      ch.check(a != b, "there should not be self-loop")
      edgeset.add((a * (n + 1) + b))

    ch.checkLength(edgeset, m)
开发者ID:AI-comp,项目名称:Orientation2014Problems,代码行数:26,代码来源:validator.py


注:本文中的checker.Checker.checkRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。