結果

問題 No.2742 Car Flow
ユーザー tipstar0125
提出日時 2024-04-21 14:50:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 220 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 98,688 KB
最終ジャッジ日時 2024-10-13 13:37:59
合計ジャッジ時間 5,126 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
sum=sum(A)
if sum==0 or sum==N:
    print(0)
    exit(0)
MOD=998244353
cnt=0
for i in range(N):
    if A[i]==0 and A[(i+1)%N]==1:cnt+=1
ans=cnt*pow(N,-1,MOD)%MOD
print(ans)
0