回答編集履歴

2

修正

2016/08/14 22:31

投稿

Zuishin
Zuishin

スコア28662

test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  var sub = IPAddress.Parse(((string[])mo["IPSubnet"])[0]).GetAddressBytes();
38
38
 
39
- Console.WriteLine(new IPAddress(ip.Select((b, i) => (byte)(b | (sub[i]) ^ 255)).ToArray()));
39
+ Console.WriteLine(new IPAddress(ip.Select((b, i) => (byte)(b | (sub[i] ^ 255))).ToArray()));
40
40
 
41
41
  }
42
42
 

1

ブロードキャストアドレス

2016/08/14 22:31

投稿

Zuishin
Zuishin

スコア28662

test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
  var sub = IPAddress.Parse(((string[])mo["IPSubnet"])[0]).GetAddressBytes();
38
38
 
39
- Console.WriteLine(new IPAddress(ip.Select((b, i) => (byte)(b & sub[i])).ToArray()));
39
+ Console.WriteLine(new IPAddress(ip.Select((b, i) => (byte)(b | (sub[i]) ^ 255)).ToArray()));
40
40
 
41
41
  }
42
42