fork(3) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define A 9999
  6. int B(int C);
  7. char* D(long E);
  8. int main(void) {
  9.  
  10. char F[A];
  11. char G[((A - 1) * 8) + 1];
  12. char *H;
  13. char I[9];
  14. char J[] = "==";
  15. char K[] = "00000";
  16. char L[] = "lksOm9BteESFLuDaNiUho1dwnRG0yc+jAKpXgYrH6xIQPW4vM7q32TbfZC8/5VJz";
  17. char M[] = "ig7kifWsutu9w3n2w214n3kgLoCHwTiojN==";
  18. long N[A];
  19. long O, P, Q, R;
  20. int S, T;
  21.  
  22. scanf_s("%s", &F, A);
  23.  
  24. for (int i = 0; i < A; i++)
  25. N[i] = B(F[i]);
  26.  
  27. for (int i = 0; i < A; i++) {
  28. if (N[i] != 0) {
  29. H = D(N[i]);
  30. strcat_s(G, H);
  31. }
  32. }
  33.  
  34. memset(N, 0, A);
  35. S = 0;
  36. for (int i = 0; i < strlen(G); i += 6) {
  37. strncpy_s(I, G + i, 6);
  38. if (strlen(I) < 6) {
  39. T = 3 - (strlen(I) / 2);
  40. strncat_s(I, K, 6 - strlen(I));
  41. }
  42. O = atoi(I);
  43. R = 0;
  44. Q = 1;
  45. while (O != 0) {
  46. if (O % 10)
  47. R += Q;
  48. O /= 10;
  49. Q *= 2;
  50. }
  51. N[S] = R;
  52. S++;
  53. }
  54.  
  55. memset(G, 0, ((A - 1) * 8) + 1);
  56. for (int i = 0; i < S; i++) {
  57. G[i] = L[N[i]];
  58. }
  59.  
  60. for (int i = S; i < S + T; i++) {
  61. G[i] = '=';
  62. }
  63. printf("%s\n", G);
  64.  
  65. if (!strcmp(G, M)) {
  66. printf("Correct!!!\n");
  67. }
  68. else {
  69. printf("it's not FLAG!!\n");
  70. }
  71.  
  72. return 0;
  73.  
  74. }
  75.  
  76. int B(int C) {
  77. int U;
  78. int V = 0;
  79. int W = 1;
  80. while (C > 0) {
  81. U = C % 2;
  82. V += U*W;
  83. C = C / 2;
  84. W *= 10;
  85. }
  86. return V;
  87. }
  88.  
  89. char* D(long E) {
  90. static char X[9] = { NULL };
  91. char Y[9] = { NULL };
  92. char Z[((A - 1) * 8) + 1] = { NULL };
  93. _itoa_s(E, X, 10);
  94. strcpy_s(Y, sizeof(X), X);
  95. memset(X, 0, 9);
  96. for (int i = 0; i < (8 - strlen(Y)); i++) {
  97. X[i] = '0';
  98. }
  99. strcat_s(X, Y);
  100. return X;
  101. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
flag
compilation info
prog.c: In function ‘main’:
prog.c:22:2: warning: implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration]
  scanf_s("%s", &F, A);
  ^~~~~~~
prog.c:30:4: warning: implicit declaration of function ‘strcat_s’ [-Wimplicit-function-declaration]
    strcat_s(G, H);
    ^~~~~~~~
prog.c:37:3: warning: implicit declaration of function ‘strncpy_s’ [-Wimplicit-function-declaration]
   strncpy_s(I, G + i, 6);
   ^~~~~~~~~
prog.c:40:4: warning: implicit declaration of function ‘strncat_s’ [-Wimplicit-function-declaration]
    strncat_s(I, K, 6 - strlen(I));
    ^~~~~~~~~
prog.c:19:10: warning: unused variable ‘P’ [-Wunused-variable]
  long O, P, Q, R;
          ^
prog.c:14:7: warning: unused variable ‘J’ [-Wunused-variable]
  char J[] = "==";
       ^
prog.c: In function ‘D’:
prog.c:90:23: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
  static char X[9] = { NULL };
                       ^~~~
prog.c:90:23: note: (near initialization for ‘X[0]’)
prog.c:91:16: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
  char Y[9] = { NULL };
                ^~~~
prog.c:91:16: note: (near initialization for ‘Y[0]’)
prog.c:92:32: warning: initialization makes integer from pointer without a cast [-Wint-conversion]
  char Z[((A - 1) * 8) + 1] = { NULL };
                                ^~~~
prog.c:92:32: note: (near initialization for ‘Z[0]’)
prog.c:93:4: warning: implicit declaration of function ‘_itoa_s’ [-Wimplicit-function-declaration]
    _itoa_s(E, X, 10);
    ^~~~~~~
prog.c:94:4: warning: implicit declaration of function ‘strcpy_s’ [-Wimplicit-function-declaration]
    strcpy_s(Y, sizeof(X), X);
    ^~~~~~~~
prog.c:92:7: warning: unused variable ‘Z’ [-Wunused-variable]
  char Z[((A - 1) * 8) + 1] = { NULL };
       ^
prog.c: In function ‘main’:
prog.c:60:24: warning: ‘T’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  for (int i = S; i < S + T; i++) {
                      ~~^~~
/home/h7EmEp/ccnkepFj.o: In function `D':
prog.c:(.text+0x54): undefined reference to `_itoa_s'
prog.c:(.text+0x6a): undefined reference to `strcpy_s'
prog.c:(.text+0xf2): undefined reference to `strcat_s'
/home/h7EmEp/ccnkepFj.o: In function `main':
prog.c:(.text.startup+0x11a): undefined reference to `scanf_s'
prog.c:(.text.startup+0x19b): undefined reference to `strcat_s'
prog.c:(.text.startup+0x22e): undefined reference to `strncpy_s'
prog.c:(.text.startup+0x297): undefined reference to `strncat_s'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty