Submission #735817


Source Code Expand

import sys


def modulo(k, n):
  m = k % n
  while m < 0:
    m += n
  return m


def main():
  length, speed_x, speed_y, start, end = [int(s) for s in sys.stdin.read().split()]
  right_distance = modulo(end - start, length)
  left_distance = length - right_distance if right_distance > 0 else 0
  time = float(right_distance) / (speed_x + speed_y)
  if speed_y > speed_x:
    time = min(time, float(left_distance) / (speed_y - speed_x))
  print '%.10f' % time


if __name__ == '__main__':
  main()

Submission Info

Submission Time
Task A - 動く歩道
User hazuki
Language Python (2.7.6)
Score 100
Code Size 521 Byte
Status AC
Exec Time 1664 ms
Memory 4100 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt
Case Name Status Exec Time Memory
01.txt AC 1664 ms 4100 KiB
02.txt AC 26 ms 2568 KiB
03.txt AC 27 ms 2568 KiB
04.txt AC 25 ms 2568 KiB
05.txt AC 25 ms 2568 KiB
06.txt AC 27 ms 2568 KiB
07.txt AC 25 ms 2568 KiB
08.txt AC 27 ms 2568 KiB
09.txt AC 27 ms 2568 KiB
10.txt AC 27 ms 2568 KiB
11.txt AC 25 ms 2568 KiB
12.txt AC 25 ms 2568 KiB
13.txt AC 27 ms 2568 KiB
14.txt AC 26 ms 2568 KiB
15.txt AC 27 ms 2568 KiB
16.txt AC 25 ms 2568 KiB
sample_01.txt AC 27 ms 2568 KiB
sample_02.txt AC 25 ms 2568 KiB
sample_03.txt AC 25 ms 2568 KiB
sample_04.txt AC 28 ms 2568 KiB