⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toj_2841.cpp

📁 Tianjin University Online Judge 的80多道题目 .
💻 CPP
字号:
/* 2008.2.17.Wang Xiaoning2841.   Bitwise Reverse Time Limit: 1.0 Seconds   Memory Limit: 65536KTotal Runs: 475   Accepted Runs: 370Professor Robby invents a powerful encryption method, but he is too lazy to implement it. So he turns to you for help.In fact, the encryption method is only applied to positive integers. At first, we express the number as binary code, that is, a string only contain '0' and '1', and the first digit can't be '0'. Then we reverse the string. And the last step, we calculate the reversed binary code and express it in decimal again.For example, we want to encrypt the number 14, we express it as 1110, after reversing it we get 0111, and (0111)2 = 7. So we get 7.InputThere is only one line for each test case, containing the positive integer to be encrypted. You can assume the number is not more than 106.The input is terminated with a zero.OutputOutput one line for each test case, indicating the number after encryption.Sample Input56140Sample Output537Problem Setter: RoBaSource: Tianjin Metropolitan Collegiate Programming Contest 2007*/#include<cstdio>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -