Advertisement
Saleh127

CF 1391B

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