119142024-11-19 18:54:26banhelyiVirágos rét (50 pont)cpp17Compilation error
#include <iostream>

using namespace std;

int main()
{
    int n;
    int k;
    int szam;
    int ja=0;
    int j;
    cin >> n;
    cin >> k;
    for(int i=0; i < n; i++){
        cin >> j;
        ja += j;
    }
	int jo=(ja-1)-(k-1);
    int jo=(jo+1)*(jo)/2;
    cout << ((ja-1>=k-1)?jo:0) << "\n";

    return 0;
}
Compilation error
open /var/local/lib/isolate/416/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:19:9: error: redeclaration of 'int jo'
   19 |     int jo=(jo+1)*(jo)/2;
      |         ^~
main.cpp:18:13: note: 'int jo' previously declared here
   18 |         int jo=(ja-1)-(k-1);
      |             ^~