题目-负二进制 (shiyancang.cn) 进制的实质在于对于进制数的选择,选择不满足的填入当前的位置,然后除掉,继续开始选择.但是对于本题,是负数,但是进制上的数字为正数,所以就要调整,借位,因为符号不同,所以借位就是增加,进位就是减去.还有循环进位 #include<bits/stdc++.h> using namespace std; const int N=1e6+520; int n,k=0; int ans[N]; int main() { scanf("%d&quo…
Given a number N, return a string consisting of "0"s and "1"s that represents its value in base -2 (negative two). The returned string must have no leading zeroes, unless the string is "0". Example 1: Input: 2 Output: "1…
请点击页面左上角 -> Fork me on Github 或直接访问本项目Github地址:LeetCode Solution by Swift 说明:题目中含有$符号则为付费题目. 如:[Swift]LeetCode156.二叉树的上下颠倒 $ Binary Tree Upside Down 请下拉滚动条查看最新 Weekly Contest!!! Swift LeetCode 目录 | Catalog 序 号 题名Title 难度 Difficulty 两数之…
There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it ! Input The input contains several test cases, please…