by@moratorium08
WA
#include<stdio.h> int m(int x) { int lb = 0; int ub = x; while((ub - lb) > 1) { int mb = (ub + lb) / 2; if (mb * mb > x)ub = mb; else lb = mb; } return lb; } int main() { char s[8]; for(int i=0;i<50;i++) { gets(s); int x=0; for(int j=0; j<8;j++) { x *= 2; x += (s[j]=='1'); } int y = 1 + 8 * x; int z =m(y); printf("%d", z * z / y); } return 0; }
11111000 00000001 10100000 10110000 00000110 01011011 00110110 01000001 11110011 11111101 11011000 11010010 00000011 00101101 10011010 00000011 11011110 10111110 01000010 00010100 01111000 01010001 11100111 00100100 10100011 11000000 00000000 10001000 00001111 10101100 10101011 11101100 00001010 01101001 00001100 00010101 10000001 00011100 00110111 00111001 00010111 11001100 11001000 11011111 01001100 01011000 01001110 10101011 01110100 10011001
/tmp/code.c: In function ‘main’: /tmp/code.c:16:9: warning: ‘gets’ is deprecated [-Wdeprecated-declarations] gets(s); ^ In file included from /usr/include/stdio.h:936:0, from /tmp/code.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:233:1: note: declared here gets (char *__str) ^ /tmp/code.c:16:9: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result [-Wunused-result] gets(s); ^ /tmp/ccfLuURj.o: In function `main': code.c:(.text.startup+0x29): warning: the `gets' function is dangerous and should not be used. *** buffer overflow detected ***: /tmp/code terminated ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fae926d27e5] /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7fae9277411c] /lib/x86_64-linux-gnu/libc.so.6(+0x117120)[0x7fae92772120] /lib/x86_64-linux-gnu/libc.so.6(__gets_chk+0x1a2)[0x7fae927720b2] /tmp/code[0x40053d] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fae9267b830] /tmp/code[0x4005f9] ======= Memory map: ======== 00400000-00401000 r-xp 00000000 00:22 144 /tmp/code 00600000-00601000 r--p 00000000 00:22 144 /tmp/code 00601000-00602000 rw-p 00001000 00:22 144 /tmp/code 00ef7000-00f19000 rw-p 00000000 00:00 0 [heap] 7fae92445000-7fae9245b000 r-xp 00000000 00:22 151 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fae9245b000-7fae9265a000 ---p 00016000 00:22 151 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fae9265a000-7fae9265b000 rw-p 00015000 00:22 151 /lib/x86_64-linux-gnu/libgcc_s.so.1 7fae9265b000-7fae9281b000 r-xp 00000000 00:22 44 /lib/x86_64-linux-gnu/libc-2.23.so 7fae9281b000-7fae92a1b000 ---p 001c0000 00:22 44 /lib/x86_64-linux-gnu/libc-2.23.so 7fae92a1b000-7fae92a1f000 r--p 001c0000 00:22 44 /lib/x86_64-linux-gnu/libc-2.23.so 7fae92a1f000-7fae92a21000 rw-p 001c4000 00:22 44 /lib/x86_64-linux-gnu/libc-2.23.so 7fae92a21000-7fae92a25000 rw-p 00000000 00:00 0 7fae92a25000-7fae92a4b000 r-xp 00000000 00:22 37 /lib/x86_64-linux-gnu/ld-2.23.so 7fae92c3a000-7fae92c3d000 rw-p 00000000 00:00 0 7fae92c47000-7fae92c4a000 rw-p 00000000 00:00 0 7fae92c4a000-7fae92c4b000 r--p 00025000 00:22 37 /lib/x86_64-linux-gnu/ld-2.23.so 7fae92c4b000-7fae92c4c000 rw-p 00026000 00:22 37 /lib/x86_64-linux-gnu/ld-2.23.so 7fae92c4c000-7fae92c4d000 rw-p 00000000 00:00 0 7fff567b9000-7fff567da000 rw-p 00000000 00:00 0 [stack] 7fff567fe000-7fff56800000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] /home/esolang/bin/c-gcc: line 6: 13 Done cat - 14 Aborted (core dumped) | /tmp/code