|
|
вернуться в форумC, How to understand it? this is a succsesful answer in C, but I want to understand it. Who can help me? #include <stdio.h> #include <stdlib.h> int main() { int n, x=1, FM; int arr[1000]; scanf("%d", &n); if(n<=1000 && n>=3) { for(int i=0; i<n; i++) { scanf("%d", &arr[i]); } FM=arr[0]+arr[1]+arr[2]; for(int i=1; i<n-2; i++) { if(arr[i]+arr[i+1]+arr[i+2]>FM) { FM=arr[i]+arr[i+1]+arr[i+2]; x=i+1; } } } printf("%d %d", FM, x+1); return 0; } Edited by author 10.10.2019 12:53 |
|
|