#include <stdio.h> int main() { int N,n,K,k,i,j,v,mv = 2020; scanf("%d %d",&N,&K); for (n = 0; n < N; n++) { i = n + 1; j = 1; for (k = 0; k < n+1; k++) { scanf("%d",&v); if (i*j <= K && v < mv) mv = v; i--; j++; } } printf("%d\n",mv); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> int main() { int N,n,K,k,i,j,v,mv = 2020; scanf("%d %d",&N,&K); for (n = 0; n < N; n++) { i = n + 1; j = 1; for (k = 0; k < n+1; k++) { scanf("%d",&v); if (i*j <= K && v < mv) mv = v; i--; j++; } } printf("%d\n",mv); return 0; } |