daily pastebin goal
57%
SHARE
TWEET

Untitled

a guest Mar 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include<fstream>
  3. using namespace std;
  4. ifstream cin ("paranteze1.in");
  5. ofstream cout("paranteze1.out");
  6. struct stiva
  7. {int v[1002],varf;
  8. };
  9. int suma(char s[260])
  10. {int sum=0;
  11.     for(int i=0;i<strlen(s);i++)
  12. {if(s[i]=='(')
  13.     sum=sum+1;
  14.     else if(s[i]==')')
  15.         sum=sum-1;
  16. }
  17.  return sum;
  18. }
  19. int main()
  20. {char s[260];
  21.     int n,sum;
  22.  cin>>n;
  23.  for(int i=1;i<=n;i++)
  24.  {cin.get();
  25.   cin.getline(s,260);
  26.   if(s[0]=='('&&s[strlen(s)-1]==')')
  27.   {if(proba(s)==0) cout<<1<<endl;
  28.    else cout<<0<<endl;
  29.   }
  30.   else cout<<0<<endl;
  31.   return 0;
  32.  
  33.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top