#include<bits/stdc++.h> int main() { int n,k,x,year=INT_MAX; scanf("%d%d",&n,&k); for(int j=0;j<n;++j) for(int i=0;i<=j;++i) { scanf("%d",&x); if((x<year)&&((i+1)*(j-i+1)<=k)) year=x; } printf("%d",year); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #include<bits/stdc++.h> int main() { int n,k,x,year=INT_MAX; scanf("%d%d",&n,&k); for(int j=0;j<n;++j) for(int i=0;i<=j;++i) { scanf("%d",&x); if((x<year)&&((i+1)*(j-i+1)<=k)) year=x; } printf("%d",year); return 0; } |