#include int main() { int a[] = { 11, 2, 7, 12, 17, 16, 12, 9, -2, -5, -8, -11, -12, 22 }; int currentLength = 2, maxLength = 0, currentRatio = 0, maxRatio = 0; for (int i = 1;i < sizeof(a)/sizeof(int); i++) { int ratio = a[i] - a[i - 1]; if (currentRatio == ratio) { currentLength++; } else { if (currentLength > maxLength) { maxLength = currentLength; maxRatio = currentRatio; } else if (currentLength == maxLength && currentRatio > maxRatio) { maxRatio = currentRatio; } currentLength = 2; } currentRatio = ratio; } printf("%d %d", maxLength, maxRatio); return 0; }