Untitled
unknown
plain_text
a year ago
619 B
3
Indexable
Never
#include <stdio.h> int main() { int t,n; scanf("%d",&t); while (t--) { int s=0, mn=1e7; scanf("%d",&n); int a[n]; for (int i = 0; i <n; i++) { scanf("%d",&a[i]); } for (int i = 1; i < n; i++) { for (int j =i+1 ; j <= n; j++) { s=(a[i-1]+a[j-1]+j-i); if (s<mn) { mn=s; } } } printf("%d",mn); } return 0; }