CODE FESTIVAL 2014 決勝(オープン)

Submission #418326

Source codeソースコード

def calc(num):
    numli = list(map(int, list(str(num))))
    numli = numli[::-1]
    res = 0
    for i in range(0, len(numli)):
        res += numli[i] * (num ** i)
    return res

A = int(input())
if A < 10:
    print(-1)
    exit(0)

res = 1
while True:
    c = calc(res)
    if A == c:
        print(res)
        break
    elif c > A:
        print("-1")
        break
    res += 1

Submission

Task問題 C - N進数
User nameユーザ名 yumechi0525
Created time投稿日時
Language言語 Python3 (3.2.3)
Status状態 AC
Score得点 100
Source lengthソースコード長 409 Byte
File nameファイル名
Exec time実行時間 239 ms
Memory usageメモリ使用量 8820 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample -
All 100 / 100 test_01.txt,test_02.txt,test_03.txt,test_04.txt,test_05.txt,test_06.txt,test_07.txt,test_08.txt,test_09.txt,test_10.txt,test_11.txt,test_12.txt,test_13.txt,test_14.txt,test_15.txt,test_16.txt,test_17.txt,test_18.txt,test_19.txt,test_20.txt,test_21.txt,test_22.txt,test_23.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 128 ms 8496 KB
sample_02.txt AC 232 ms 8612 KB
sample_03.txt AC 235 ms 8612 KB
test_01.txt AC 127 ms 8624 KB
test_02.txt AC 235 ms 8608 KB
test_03.txt AC 239 ms 8612 KB
test_04.txt AC 190 ms 8612 KB
test_05.txt AC 201 ms 8616 KB
test_06.txt AC 148 ms 8644 KB
test_07.txt AC 128 ms 8620 KB
test_08.txt AC 161 ms 8616 KB
test_09.txt AC 125 ms 8620 KB
test_10.txt AC 194 ms 8612 KB
test_11.txt AC 128 ms 8624 KB
test_12.txt AC 155 ms 8612 KB
test_13.txt AC 127 ms 8544 KB
test_14.txt AC 232 ms 8612 KB
test_15.txt AC 126 ms 8496 KB
test_16.txt AC 233 ms 8616 KB
test_17.txt AC 143 ms 8624 KB
test_18.txt AC 234 ms 8612 KB
test_19.txt AC 128 ms 8616 KB
test_20.txt AC 233 ms 8624 KB
test_21.txt AC 238 ms 8820 KB
test_22.txt AC 235 ms 8608 KB
test_23.txt AC 162 ms 8616 KB