#include <stdio.h> using namespace std; int main() { int n; long int k, val; int oldest = 2019; scanf ("%d",&n); scanf ("%d",&k); for(int i = 1; i <= n; i++){ for(int j = 0; j < i; j++){ int temp = (i - j) * (j + 1); scanf ("%d",&val); if(temp <= k && val < oldest) oldest = val; } } printf("%d", oldest); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <stdio.h> using namespace std; int main() { int n; long int k, val; int oldest = 2019; scanf ("%d",&n); scanf ("%d",&k); for(int i = 1; i <= n; i++){ for(int j = 0; j < i; j++){ int temp = (i - j) * (j + 1); scanf ("%d",&val); if(temp <= k && val < oldest) oldest = val; } } printf("%d", oldest); return 0; } |