Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std ;
- typedef long long ll ;
- int main() {
- ios::sync_with_stdio(false) ; cout.tie(NULL) ; cin.tie(NULL) ;
- int num ; cin >> num ;
- int n ; cin >> n ;
- ll arr[n];
- ll arr2[n] ;
- for (int i = 0; i < n; i++) cin >> arr[i] ;
- while (num--) {
- for (int i = 0; i < n; i++) {
- for (int j = 0; i < n; j++) {
- if (i < j) {
- arr2[i] = arr[i] + arr[j] + j - i ;
- }
- }
- }
- }
- int Min = arr2[0] ;
- for (int i = 0; i < n; i++) {
- if (arr2[i] < Min)
- Min = arr2[i] ;
- }
- cout << Min ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement