fork(1) download
  1. #include<stdio.h>
  2. #include<math.h>
  3. #include<string.h>
  4. #define scand(n) scanf("%d",&n)
  5. #define scanld(n) scanf("%ld", &n)
  6. #define printd(n) printf("%d", n)
  7. #define printld(n) printf("%ld\n", n)
  8. #define linedown printf("\n");
  9. int main(){
  10. int m,n;
  11. scand(m); scand(n);
  12. if (m>n){
  13. for (int i=1; i<=m; i++){
  14. if (i<=n){
  15. for (int j=i; j<=n;j++) printd(j);
  16. for (int j=i-1; j>=1;j--) printd(j);
  17. }
  18. if (i>n){
  19. printd(i);
  20. for (int j=n-1; j>=1; j--) printd(j);
  21. }
  22. printf("\n");
  23. }
  24.  
  25. } else {
  26. for (int i=1; i<=m; i++){
  27. for (int j=i; j<=n;j++) printd(j);
  28. for (int j=i-1; j>=1;j--) printd(j);
  29. printf("\n");
  30. }
  31. }
  32. }
  33.  
Success #stdin #stdout 0.01s 5560KB
stdin
Standard input is empty
stdout
Standard output is empty