All submissions for this problem are available.
A subnetwork, or subnet, is a logically visible subdivision of an IP network. The practice of dividing a network into sub-networks is called subnetting.
All computers that belong to a subnet are addressed with a common, identical, most-significant bit-group in their IP address. This results in the logical division
of an IP address into two fields, a network or routing prefix and the rest field. The rest field is a specific identifier for the computer or the network
The Network Administrator in our organization is on leave and we need to subnet our IP networks so that there are ‘m’ additional networks. Your job is to write a
program that provides a correct subnet mask for the given IP Address.
Problem Setter: Vishal Gupta
Each input line contains an IP Address and ‘m’ - the number of additional networks.
For each corresponding IP and ‘m’ Output the subnet mask in a new line.
Sample Input: 184.108.40.206 5 220.127.116.11 11 192.168.100.20 17 Sample Output: 255.255.255.224 255.255.240.0 255.255.255.248
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.