19482022-12-12 12:52:57DragonoidOmegaÁruszállítás üres szakaszaicpp11Forditási hiba
#include <iostream>
#include <vector>

using namespace std;
int i,n,m,a,b,db;
int main()
{
    cin>>n>>m;
    vector <long long> x(n+2);
    for(i=1;i<=m;++i)
    {
        cin>>a>>b;
        x[a]++;
        x[b+1]--;
    }
    ++n;
    --db
    for(i=1;i<=n;++i)
    {
        x[i]+=x[i-1];
        if(x[i]==0 && x[i-1]!=0) db++;
    }
    if(x[1]==0) ++db;
    cout<<db;
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:17:9: error: expected ';' before 'for'
   17 |     --db
      |         ^
      |         ;
   18 |     for(i=1;i<=n;++i)
      |     ~~~  
main.cpp:18:21: error: expected ';' before ')' token
   18 |     for(i=1;i<=n;++i)
      |                     ^
      |                     ;
Exited with error status 1