3
4

More than 3 years have passed since last update.

AtCoder:Python:サンプルテストをパパっとする。

Last updated at Posted at 2020-08-30

以下のように記載してINPUTのところにテストケースの入力をコピペすると楽。ついでに実行時間を測れる。

test.py
import io
import sys
import time
_INPUT = """\
#ここに入力をコピペ
"""
StartTime = time.time()
sys.stdin = io.StringIO(_INPUT)
# --------------------------------------------------------
#ここに処理を記載
# --------------------------------------------------------
print ("[Sec]"+str(time.time() - StartTime))

例:

example_ABC177_A.py
import io
import sys
import time
_INPUT = """\
1000 15 80
"""
StartTime = time.time()
sys.stdin = io.StringIO(_INPUT)
# --------------------------------------------------------
d,t,s=map(int, input().split())

if d<=s*t:print("Yes")
else:print("No")
# --------------------------------------------------------
print ("[Sec]"+str(time.time() - StartTime))

出力

example_ABC177_A.py
Yes
[Sec]0.0009970664978027344

提出は点線の中だけ行う。

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4