結果

問題 No.1505 Zero-Product Ranges
ユーザー harurun
提出日時 2021-05-15 00:39:54
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 209 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 28,160 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 07:30:21
合計ジャッジ時間 2,025 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int n,a,i=0,c=0;
long long ans=0;
int main(){
  scanf("%d",&n);
  for(;i<n;i++){
    scanf("%d",&a);
    if(a)ans+=c;
    else{
      c=i+1;
      ans+=c;
    }
  }
  printf("%lld\n",ans);
}
0