Processing math: 66%
Solutions of Average - MarisaOJ: Marisa Online Judge

Solutions of Average

Select solution language

Write solution here.


User Avatar nhanzzzz    Created at    9 likes

***phân tích*** + gọi x là độ dài của đoạn con + (A1+A2+A3+A4+...+Ax)/x=k + (A1+A2+A3+A4+...+Ax)=kx + (A1k+A2k+A3k+A4k+...+Axk)=0 ***thực hiện*** + trừ k vào tất cả các phần tử + đếm các đoạn con có tổng bằng 0 ***code mẫu*** #clude<bitsstdc++.h>#defelonglongusingnamespacestd;sigdma(){ios::syncwithstdio(0);c.tie(0);cout.tie(0);/n,k;cnk;r<>arr(n);for(i=0;i<n;i++){carr[i];arr[i]k;}/cs=0,t=0;unorderedmap<,>d;d[0]=1;for(i:arr){cs+=i;if