結果
| 問題 | No.1231 Make a Multiple of Ten |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-29 21:40:33 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 142 ms / 2,000 ms |
| コード長 | 634 bytes |
| 記録 | |
| コンパイル時間 | 423 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 37,800 KB |
| 最終ジャッジ日時 | 2026-05-16 11:23:16 |
| 合計ジャッジ時間 | 3,218 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 |
ソースコード
from itertools import combinations
def Ten(N, A):
sumA = sum(A)
if sumA % 10 == 0:
return N
tens = []
for i in range(1, N // 2 + 1):
combs = list(combinations(A, i))
for j in range(len(combs)):
sumj1 = sum(combs[j])
sumj2 = sumA - sumj1
if sumj1 % 10 == 0:
tens.append(i)
if sumj2 % 10 == 0:
return N - i
if len(tens) > 0:
return max(tens)
else:
return 0
def main():
N = int(input())
A = list(map(int, input().split()))
print(Ten(N, A))
if __name__ == '__main__':
main()