Advertisement
Saleh127

CF 1419A

Sep 19th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11. ///!@]B
  12.  
  13. test
  14. {
  15. ll n,c,d,r=0,e=0,f,i,j,k,l;
  16. string a;
  17.  
  18. cin>>n;
  19. cin>>a;
  20. if(n%2)
  21. {
  22. for(i=0; i<n; i++)
  23. {
  24. if(i%2==0 && (a[i]-'0')%2==1)
  25. {
  26. r=1;
  27. }
  28. }
  29. if(r) cout<<1<<endl;
  30. else cout<<2<<endl;
  31. }
  32. else
  33. {
  34. for(i=0; i<n; i++)
  35. {
  36. if(i%2==1 && (a[i]-'0')%2==0)
  37. {
  38. e=1;
  39. }
  40. }
  41. if(e) cout<<2<<endl;
  42. else cout<<1<<endl;
  43. }
  44. }
  45. return 0;
  46. }
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement