Advertisement
Guest User

Untitled

a guest
Dec 12th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <inttypes.h>
  3.  
  4. int main() {
  5. int n, w;
  6. scanf("%d%d", &n, &w);
  7. int32_t i, tpr = 1 << n;
  8. int32_t c=0;
  9. int f=0;
  10. for (i = 0; i < tpr; ++i) {
  11. printf("|%*" PRIx32, w, i);
  12. printf("|%*" PRIu32, w, i);
  13.  
  14. if(i < tpr/2) {
  15. printf("|%*" PRId32, w, c);
  16. printf("|\n");
  17. c++;
  18. }
  19. else {
  20.  
  21. if(!f) {
  22. c=-c;
  23. }
  24. f=1;
  25. printf("|%*" PRId32, w, c);
  26. printf("|\n");
  27. ++c;
  28. }
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement