177252025-09-16 18:15:01algoproPontos Átlagcpp17Compilation error
// UUID: c5defeb6-fe31-4fe0-a6fe-a86d6b86d821
#include <bits/stdc++.h>
using namespace std;
vector<int> prices;
long full_price=0;
int item_price;
int avg;
int db;
int eredmény=0;
int main() {
    cin>>db;
    cin>>avg;
    avg=avg*db;
    
    prices.reserve(db);

    while(cin>>item_price){
        full_price+=item_price;
        prices.push_back(item_price);
    }
    if (full_price<avg){
        cout<<'1';
    }
    else if(full_price==avg){
        cout<<'0';
    }
    else{
        int diff{staic_cast<int>(full_price - avg)};
        while(diff>0){
            auto iter{std::max_element(prices.begin(), prices.end())};
            int max {*iter};
            *iter = 0;
            diff-=max-1;
            eredmény+=1;

        }
        cout<<eredmény;
    }
}
Compilation error
open /var/local/lib/isolate/403/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:28:18: error: 'staic_cast' was not declared in this scope
   28 |         int diff{staic_cast<int>(full_price - avg)};
      |                  ^~~~~~~~~~
main.cpp:28:29: error: expected primary-expression before 'int'
   28 |         int diff{staic_cast<int>(full_price - avg)};
      |                             ^~~
main.cpp:28:29: error: expected '}' before 'int'
   28 |         int diff{staic_cast<int>(full_price - avg)};
      |                 ~           ^~~
main.cpp:29:15: error: 'diff' was not declared in this scope
   29 |         while(diff>0){
      |               ^~~~
main.cpp: At global scope:
main.cpp:39:1: error: expected declaration before '}' token
   39 | }
      | ^