結果
| 問題 |
No.305 鍵(2)
|
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2015-11-27 23:51:40 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,193 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 27,736 KB |
| 平均クエリ数 | 48.00 |
| 最終ジャッジ日時 | 2024-07-16 06:44:04 |
| 合計ジャッジ時間 | 2,023 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 2 |
ソースコード
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
DIGITS = 10
class Key(object):
def __init__(self):
self.guess = [0] * DIGITS
self.status = -1
self.query = 0
@property
def guess_int(self):
return sum(x * y for (x, y) in zip(self.guess,
[10 ** e for e in range(DIGITS - 1, -1, -1)]))
def get_status(self):
self.query += 1
print("{guess:0=10d}".format(guess=self.guess_int))
[n, _] = input().split()
self.status = int(n)
if self.status == DIGITS:
sys.exit(0)
def communicate(self):
for d in range(DIGITS):
for x in range(10):
self.guess[d] = x
s = int(self.status)
self.get_status()
if s == -1:
continue
elif s == self.status:
continue
elif s < self.status:
break
elif s > self.status:
self.guess[d] -= 1
break
def main():
k = Key()
k.communicate()
if __name__ == "__main__":
main()
はむ吉🐹