update
This commit is contained in:
parent
d73b45090e
commit
882ec2fbea
54
src/7/16/T633667.cpp
Normal file
54
src/7/16/T633667.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iostream>
|
||||||
|
#include <limits>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using ll = int64_t;
|
||||||
|
|
||||||
|
ll m,n,tot{};
|
||||||
|
double ans{std::numeric_limits<double>::max()};
|
||||||
|
std::vector<std::vector<ll>> s;
|
||||||
|
|
||||||
|
ll getDownSum(ll b,ll e){
|
||||||
|
ll ans{};
|
||||||
|
for(ll i=1;i<=m;i++){
|
||||||
|
for(ll j=b;j<=e;j++){
|
||||||
|
ans+=s[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
double getAver(ll b,ll e){
|
||||||
|
double ans{};
|
||||||
|
for(ll i=1;i<=m;i++){\
|
||||||
|
ll sum{};
|
||||||
|
for(ll j=1;j<=n;j++){
|
||||||
|
if(b<=j&&j<=e){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sum+=s[i][j];
|
||||||
|
}
|
||||||
|
ans+=double(sum)/double(n);
|
||||||
|
}
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
std::cin>>m>>n;
|
||||||
|
s.resize(m+1,std::vector<ll>(n+1,0));
|
||||||
|
for(ll i=1;i<=m;i++){
|
||||||
|
for(ll j=1;j<=n;j++){
|
||||||
|
std::cin>>s[i][j];
|
||||||
|
tot+=s[i][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(ll i=2;i<n;i++){
|
||||||
|
for(ll j=i;j<n;j++){
|
||||||
|
ans=std::min(getAver(i,j),ans);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout<<ans<<'\n';
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user