結果
| 問題 | 
                            No.1825 Except One
                             | 
                    
| コンテスト | |
| ユーザー | 
                             とりゐ
                         | 
                    
| 提出日時 | 2021-12-23 03:28:40 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 339 bytes | 
| コンパイル時間 | 400 ms | 
| コンパイル使用メモリ | 81,792 KB | 
| 実行使用メモリ | 76,016 KB | 
| 最終ジャッジ日時 | 2024-09-17 00:42:08 | 
| 合計ジャッジ時間 | 5,622 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 RE * 1 | 
| other | AC * 18 RE * 13 | 
ソースコード
n=int(input())
a=list(map(int,input().split()))
if n>20:
  raise Exception
def popcount(n):
  return bin(n).count('1')
ans=0
for bit in range(1<<n):
  k=popcount(bit)
  if k<=1:
    continue
  b=[]
  for i in range(n):
    if (bit>>i)&1:
      b.append(a[i])
  mx=max(b)
  if sum(b)%(k-1)==0 and mx<=sum(b)//(k-1):
    ans+=1
print(ans)
            
            
            
        
            
とりゐ