結果
問題 | No.1825 Except One |
ユーザー |
|
提出日時 | 2022-01-29 10:11:30 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 143 ms / 3,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 275 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 97,464 KB |
最終ジャッジ日時 | 2025-01-01 23:20:14 |
合計ジャッジ時間 | 3,610 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 31 |
ソースコード
n = int(input()) A = sorted(list(map(int,input().split()))) M = (n+2)*100 ans = 0 dp = [[0]*M for i in range(n+1)] dp[0][0] = 1 for a in A: ndp = [[0]*M for i in range(n+1)] for i in range(n+1): for j in range(M): if dp[i][j] == 0: continue ndp[i][j] += dp[i][j] ndp[i+1][j+a] += dp[i][j] if i > 0 and a*i <= j+a and (j+a)%i == 0: ans += dp[i][j] dp = ndp print(ans)