官网
1027. Colors in Mars (20)
时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented …
题目 代码
#include<iostream>
#include<cmath>
using namespace std;int bin2dec(string bin) {int len bin.length();int ans 0;for (int i 0; i < len; i) {ans ans ((int)(bin[i]) - 48) * pow(2, len - i - 1);}return ans;
}int str2dec(string s)…
LeetCode168——Excel Sheet Column Title 题目 Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB Credits: Special thanks to ifanchu …