| 
 | 
вернуться в форумWhat's wrong with my code??? Who can help me!!! #include <iostream.h> int a[2000],q[2000],o[2000]; int check(int i) {  int j;  for (j=i+1; j<a[i]; j++)   {    if (q[j]!=0) return 0;   }  for (j=i; j<=a[i]; j++)    q[j]=1;  return 1; } int main() {  int i,n,left,right,p;  cin>>n;  for (i=0; i<2000; i++) {a[i]=0; q[i]=0; o[i]=0;}  for (i=0; i<n; i++)   {    cin>>left>>right;    if (left>right)      {       p=left;       left=right;       right=p;      }    if (a[left+1000]==0) a[left+1000]=right+1000;    else if (a[left+1000]>right+1000) a[left+1000]=right+1000;   }  p=0;  for (i=0; i<2000; i++)   if ((a[i])&&(check(i)))     {      p++;      o[i]=1;     }  cout<<p<<endl;  for (i=0; i<2000; i++)   if (o[i])    cout<<i-1000<<' '<<a[i]-1000<<endl; } Test for everyone who got WA !!! Послано  Saber 3 мар 2003 18:22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` 5 1 2 2 6 3 4 4 5 5 6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Saber ssf_digi@hotmail.com  |  
  | 
|