#include<cstdio> int main(){ int n,k,i,j,d,mn=2020; scanf("%d%d",&n,&k); for(i=2;i<n+2;++i) for(j=1;j<i;++j){ scanf("%d",&d); if(j*(i-j)<=k && mn>d) mn=d; } printf("%d\n",mn); }
1 2 3 4 5 6 7 8 9 10 11 12 | #include<cstdio> int main(){ int n,k,i,j,d,mn=2020; scanf("%d%d",&n,&k); for(i=2;i<n+2;++i) for(j=1;j<i;++j){ scanf("%d",&d); if(j*(i-j)<=k && mn>d) mn=d; } printf("%d\n",mn); } |