fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int *a;
  6. int i, max, R, R1, N;
  7. cin >> N;
  8. a = new int[N];
  9. max=0;
  10. for (i=0; i<N; i++) {
  11. cin >> a[i];
  12. if (a[i]+max>max) max=a[i]+max;
  13. }
  14. if (max%3!=0) R=1;
  15. else R=max;
  16. cin >> R1;
  17. cout << "Вычисленное контрольное значение: " << R << endl;
  18. if (R==R1) cout << "Контроль пройден" << endl;
  19. else cout << "Контроль не пройден" << endl;
  20. delete [] a;
  21. return 0;
  22. }
Success #stdin #stdout 0s 4892KB
stdin
6
100
8
33
145
19
84
153
stdout
Вычисленное контрольное значение: 1
Контроль не пройден