Last active
June 27, 2017 20:44
-
-
Save doloopwhile/db199980669c17e39472 to your computer and use it in GitHub Desktop.
Paiza
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
numbers = [] | |
for line in sys.stdin: | |
numbers.append([int(s) for s in line.split()]) | |
L, _, _ = numbers[0] | |
connections = {} | |
for x, y, y2 in numbers[1:]: | |
connections[(x, y)] = (x + 1, y2) | |
connections[(x + 1, y2)] = (x, y) | |
x = 1 | |
y = L | |
while y > 0: | |
x, y = connections.get((x, y), (x, y)) | |
y -= 1 | |
print(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import sys | |
def main(): | |
pocket_count, index = map(int, sys.stdin.readline().split()) | |
q = pocket_count * 2 | |
page = (index - 1) // q | |
print(((2 * page + 1) * q + 1) - index) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
paiza回答コード掲載停止のお願い
いつもご利用ありがとうございます。
paiza運営事務局です。
こちらのgistを拝見しまして、paizaの掲載中の問題について記載されてらっしゃったため、ご連絡させていただきました。
paizaにおいては、利用規約第8条(禁止事項)10項で、問題に関する内容、解答、ヒントを含め、
他サイトでの掲載を禁止させていただいております。
利用規約第8条10項(禁止事項)
http://paiza.jp/guide/kiyaku
===
10.ブログ・SNS等本サイト以外の媒体(インターネット媒体に限られず、不特定多数が閲覧可能なものを全て含む。)上において、
当社が出題した問題の内容、当該問題に対する解答、解答へのヒント等の示唆及びカンニング等の不正を助長する内容等を掲載する行為.。
===
現在ご掲載中のコードついて、早急に削除または非掲載対応をお願いできますでしょうか。
大変お手数ですが、よろしくお願い致します。