Codeforces 1411A/1465A - In-game Chat Solution

   Solution in C++:

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh  

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int l,i,n,t,c;
  6. string s;
  7. cin>>t;
  8. while(t--)
  9. {
  10. c=0;
  11. cin>>n;
  12. cin>>s;
  13. for(i=n-1;i>=0;i--)
  14. {
  15. if(s[i]==')')
  16. c++;
  17. else
  18. break;
  19. }
  20. if(c*2>n)
  21. cout<<"Yes"<<endl;
  22. else
  23. cout<<"No"<<endl;
  24. }
  25. }

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.