当前位置:   article > 正文

蓝桥杯,省赛,兰顿蚂蚁,密码脱落

蓝桥杯,省赛,兰顿蚂蚁,密码脱落
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define N 105
  4. int m, n, x, y, k;
  5. char s;
  6. int arr[N][N];
  7. // U D L R
  8. void process() {
  9. int count = arr[x][y];
  10. arr[x][y] = arr[x][y] ? 0 : 1;
  11. switch(s) {
  12. case 'U':
  13. if(count == 0) {
  14. s = 'L';
  15. y--;
  16. }else {
  17. s = 'R';
  18. y++;
  19. }
  20. break;
  21. case 'D':
  22. if(count == 0) {
  23. s = 'R';
  24. y++;
  25. }else {
  26. s = 'L';
  27. y--;
  28. }
  29. break;
  30. case 'L':
  31. if(count == 0) {
  32. s = 'D';
  33. x++;
  34. }else {
  35. s = 'U';
  36. x--;
  37. }
  38. break;
  39. case 'R':
  40. if(count == 0) {
  41. s = 'U';
  42. x--;
  43. }else {
  44. s = 'D';
  45. x++;
  46. }
  47. }
  48. }
  49. int main() {
  50. cin >> m
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/447284?site
推荐阅读
相关标签
  

闽ICP备14008679号