19462022-12-12 12:52:10DragonoidOmegaÁ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
    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:16:8: error: expected ';' before 'for'
   16 |     ++n
      |        ^
      |        ;
   17 |     for(i=1;i<=n;++i)
      |     ~~~ 
main.cpp:17:21: error: expected ';' before ')' token
   17 |     for(i=1;i<=n;++i)
      |                     ^
      |                     ;
Exited with error status 1