Uses 51K of libraries. Click here for Pure Java version (3855L/26K/84K).
1 | !7 |
2 | |
3 | static new TreeMap<Long, S> data; |
4 | |
5 | p { |
6 | for (S s : lines(readerToString(utf8bufferedReader(lzmaInputStream(#1004343))))) { |
7 | L<S> l = tok_splitAtComma_unquote(s); |
8 | if (l(l) < 3) continue; |
9 | long start = parseLong(first(l)); |
10 | long end = parseLong(second(l)); |
11 | S country = intern(l.get(4)); |
12 | data.put(start, country); |
13 | } |
14 | print(l(data) + " " + first(keys(data))); |
15 | botSleep(); |
16 | } |
17 | |
18 | answer { |
19 | long ip = ipToInt(trim(s)); |
20 | print("s=" + s + ", ip=" + ip); |
21 | Long key = data.floorKey(ip); |
22 | if (key != null) |
23 | try answer data.get(key); |
24 | } |
Began life as a copy of #1008728
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008736 |
Snippet name: | IP to country simplified |
Eternal ID of this version: | #1008736/1 |
Text MD5: | e19ae74eef2506db4c8560235836a7f3 |
Transpilation MD5: | c5139ec9a677bc00164fae0ec8060796 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-31 02:05:23 |
Source code size: | 580 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 583 / 642 |
Referenced in: | [show references] |