Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <string>#include <map>#include <iomanip>using namespace std;char base32[32] = {'0', '1', '2', '3', '4', '5', '6', '7','8', '9', 'b', 'c', 'd', 'e', 'f', 'g','h', 'j', 'k', 'm', 'n', 'p', 'q', 'r','s', 't', 'u', 'v', 'w', 'x', 'y', 'z'};map<char, int> indexBase32 {{'0', 0}, {'1', 1}, {'2', 2}, {'3', 3}, {'4', 4}, {'5', 5}, {'6', 6}, {'7', 7},{'8', 8}, {'9', 9}, {'b', 10}, {'c', 11}, {'d', 12}, {'e', 13}, {'f', 14}, {'g', 15},{'h', 16}, {'j', 17}, {'k', 18}, {'m', 19}, {'n', 20}, {'p', 21}, {'q', 22}, {'r', 23},{'s', 24}, {'t', 25}, {'u', 26}, {'v', 27}, {'w', 28}, {'x', 29}, {'y', 30}, {'z', 31}};void Encode(double latitude, double longitude, int precision, string& geohash) {double latitudeInterval[2] = {-90, 90};double longitudeInterval[2] = {-180, 180};double mid;int length = precision * 5;int bits = 0;for(int i = 1; i <= length; ++i) {if(i & 1) {mid = (longitudeInterval[0] + longitudeInterval[1]) / 2;if(longitude > mid) {