結果

問題 No.561 東京と京都
ユーザー yamanchu3776yamanchu3776
提出日時 2017-08-26 15:30:49
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 451 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-23 17:10:06
合計ジャッジ時間 864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 10 ms
6,528 KB
testcase_02 AC 10 ms
6,528 KB
testcase_03 AC 10 ms
6,272 KB
testcase_04 WA -
testcase_05 AC 9 ms
6,528 KB
testcase_06 AC 9 ms
6,400 KB
testcase_07 AC 9 ms
6,400 KB
testcase_08 AC 9 ms
6,400 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 10 ms
6,528 KB
testcase_13 WA -
testcase_14 AC 10 ms
6,400 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N, D = map( int, raw_input().split( ) )
okane = 0
incomes = []
for i in range(N):
	incomes.append( list(map( int, raw_input().split( ))) )
pos = 0
for i in range(N):
	if pos == 0:
		if incomes[i][0] + D < incomes[i][1]:
			okane += incomes[i][1] - D
			pos = 1
		else:
			okane += incomes[i][0]
	elif pos == 1:
		if incomes[i][1] + D < incomes[i][0]:
			okane += incomes[i][0] - D
			pos = 0
		else:
			okane += incomes[i][1]

print okane
0