結果

問題 No.1472 作為の和
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-04-09 22:13:04
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,100 ms / 2,000 ms
コード長 703 bytes
コンパイル時間 1,154 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 77,144 KB
最終ジャッジ日時 2023-09-07 11:36:28
合計ジャッジ時間 2,836 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,276 KB
testcase_01 AC 79 ms
75,368 KB
testcase_02 AC 99 ms
76,964 KB
testcase_03 AC 1,100 ms
77,144 KB
testcase_04 AC 75 ms
71,232 KB
testcase_05 AC 75 ms
71,124 KB
testcase_06 AC 76 ms
71,024 KB
testcase_07 AC 75 ms
71,352 KB
testcase_08 AC 76 ms
71,276 KB
testcase_09 AC 75 ms
71,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

9999…
が最大っぽい

"""

import sys
from sys import stdin

def digsum(X):
    ret = 0
    while X:
        ret += X % 10
        X //= 10
    return ret

N = int(stdin.readline())
        
if N == 0:
    print (9,1)
elif N <= 3:
    M = int(3.14159 * (10**N))

    mulmax = 0
    mulnum = 0
    maxA,maxB = None,None
    for B in range(1,M+1):
        for A in range(1,B+1):
            if digsum(A*B) > mulmax:
                mulmax = digsum(A*B)
                mulnum = 1
                #print (A,B)
                maxA,maxB = A,B
            elif digsum(A*B) == mulmax:
                mulnum += 1
    print (mulmax,mulnum)
    #print (maxA,maxB)
else:
    print (18*(N-3) + 62 , 1)
0