Advertisement
erfanul007

Light OJ 1389

Jan 5th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5. typedef unsigned long long int ull;
  6. typedef vector<int> vi;
  7. typedef vector<vi> vvi;
  8. typedef pair<int,int> pii;
  9. typedef vector< pii > vii;
  10. typedef set<int> st;
  11.  
  12. #define pb push_back
  13. #define pob pop_back
  14. #define mp make_pair
  15. #define ff first
  16. #define ss second
  17. #define loop1(i,n) for(int i=1; i<=int(n); i++)
  18. #define loop(i,y) for(int i=0; i<int(y); i++)
  19. #define read() freopen("input.txt", "r", stdin)
  20. #define write() freopen("output.txt", "w", stdout)
  21.  
  22. /// Constants
  23. #define eps 1e-9
  24. #define PI acos(-1.0) // 3.1415926535897932
  25.  
  26. int main()
  27. {
  28. int n,i,x,tr;
  29. cin>>n;
  30. string str;
  31. loop1(i,n){
  32. cin>>x;
  33. cin>>str;
  34. int j=0;
  35. int cnt=0;
  36. tr=0;
  37. int hc=0;
  38. int ln=str.size();
  39. while(j<ln){
  40. if(str[j]=='.')
  41. cnt++;
  42. if(str[j]=='#' && cnt>0)
  43. cnt++;
  44. if(cnt==3){
  45. tr++;
  46. cnt=0;
  47. }
  48. if(cnt>0 && j==ln-1){
  49. tr++;
  50. cnt=0;
  51. }
  52. j++;
  53. }
  54. printf("Case %d: %d\n",i,tr);
  55. }
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement