Alex is administrator of IP networks. His clients have a bunch of individual IP addresses and he decided to group all those IP addresses into the smallest possible IP network. Each IP address is a 4-byte number that is written byte-by-byte in a dec…
Description Alex is administrator of IP networks. His clients have a bunch of individual IP addresses and he decided to group all those IP addresses into the smallest possible IP network. Each IP address is a 4-byte number that is written byte-by-b…
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms) //UVa1590 - IP Networks #include<iostream> unsigned i, m, num, ip[4], ipmax[4], ipmin[4], mask[4]; int cmp(unsigned *a, unsigned *b) {//compare for (int i = 0;i < 4;++i) { if (a[i] <…
IPScanner.cs public class IPScanner { private byte[] data; Regex regex = new Regex(@"(((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))\.){3}((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))"); long firstStartIpOffset; long lastStartIpOffset; long ipCount; publ…
<?php /** * 纯真IP根据IP地址获得地址 */ class ipLocation { public $fp; public $firstip; //第一条ip索引的偏移地址 public $lastip; //最后一条ip索引的偏移地址 public $totalip; //总ip数 // //* //构造函数,初始化一些变量 //$datfile 的值为纯真IP数据库的名子,可自行修改. //* function __construct($datfile = "CoralWr…