# 13975 - Frieren and her Rizz 2 https://acm.cs.nthu.edu.tw/problem/13975/ This question is modification of : * 13577 - Anya loves to encrypt : https://hackmd.io/DIrF2d6tTiqpGzRowrXN-g * 13970 - Frieren and her Rizz : https://hackmd.io/@skivap/ryeHXMkgp If you understand the 2 questions above, this should be easy If you don't, **I suggest you to take a look at this 2 questions first** ## Solution 1. Convert the binary into number, let say it store to variable X 2. Convert the number to character by adding 64 (see ASCII) 3. Reverse the alphabet (formula : Char = 155 - X) 4. Convert it to lowercase if the signed bit is 1 (Char = Char + 32 * signed_bit) ## First Way of Code ```cpp= #include <stdio.h> int main(){ int binary; scanf("%d", &binary); int num = 0; // we will convert the binary to integer num += binary%10 * 1; // taking the 1st lastest digit and convert to integer binary = binary/10; // remove the 1st lastest digit num += binary%10 * 2; // taking the 2nd lastest digit and convert to integer binary = binary/10; // remove the 2nd lastest digit num += binary%10 * 4; // and so on... binary = binary/10; num += binary%10 * 8; binary = binary/10; num += binary%10 * 16; // taking the first digit of binary binary = binary/10; // now the binary would be either 1 or 0 in this state char ch = 155 - (num + 64); // convert integer to character ch = ch + binary * 32; // if the signed binary is 1, it will convert to uppercase printf("%c\n", ch); } // by Aurick ``` ## Second Way of Code ```cpp= #include <stdio.h> int main(){ int a,b,c,d,e,f; scanf("%1d%1d%1d%1d%1d%1d", &a, &b, &c, &d, &e, &f); char ch = b * 16 + c * 8 + d * 4 + e * 2 + f + 64; ch = 155 - ch; ch = ch + a * 32; printf("%c\n", ch); } // by Aurick ```