CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Compete » DreamSpark - Microsoft Software & Technology Club » What is your IP

What is your IP

Problem code: DSPCXI01

  • All Submissions

All submissions for this problem are available.

The IP Address Class defines the number of networks and IP addresses that are available to an organization for use. An IP Address is comprised of 32 bits (4 octets) of information. The IP address is working with two pieces of information: the network ID and the host ID. Based on the number of network and hosts the IP Addresses have been divided into different classes – A, B, C, D & E.

Currently the NetTech team is conducting its certification course at BIT Mesra. Ayush Kedia is a first year student and has little knowledge of networking. However the test is coming up and he needs your help to top the list. He has a list of IPs which has to be classified based on the IP Addresses. Your job is to write a program that will print the class of the given IP Address.

Problem Setter: Vishal Gupta

Input:

The input contains a series of IP addresses, each beginning in a new line.

Output:

For each IP Address print the class of the IP Address each in a single line. Print ‘Invalid’ for any invalid entry.

Input:
192.168.102.11
10.87.78.0
189.09.89.98
225.78.98.89
25.98.268.09
0.0.0.0
Output: Class C Class A Class B Class D Invalid Invalid


Author: ganesha
Date Added: 19-02-2011
Time Limit: 1 sec
Source Limit: 50000 Bytes
Languages: ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC


  • Submit

Comments

  • Login or Register to post a comment.

please visit

ganesha @ 26 Feb 2011 05:43 PM

please visit http://dreamsparkyatra.mstc-india.com/whatisyourip.html to view the problem statement.

@gupta   0.0.0.0 is consider

idontknowisitim @ 26 Feb 2011 06:04 PM

@gupta

 

0.0.0.0 is consider to be valid address

 

correct me if i m wrong

plz clarify...what are

paarth @ 26 Feb 2011 06:10 PM

plz clarify...what are classes and how do we have to assign classes...??.....

your redirecting us from here to the site ...is troubling....plz do the required.....

Please explain the output

dinemont @ 26 Feb 2011 06:47 PM

Please explain the output

@ALL: We haven't explained

ganesha @ 26 Feb 2011 06:54 PM

@ALL: We haven't explained the output because it is expected that you know, and in case you don't know you can use wikipedia, infosys campus connect,google, bing, yahoo etc.

@idontknow: I am pretty sure that 0.0.0.0 is invalid. And there are few other cases.

how many inputs????

devrajchouhan @ 26 Feb 2011 07:30 PM

how many inputs????

Yes plz calrify on the number

mtk @ 26 Feb 2011 07:50 PM

Yes plz calrify on the number of inputs?

please clarify ..how many

devrajchouhan @ 26 Feb 2011 07:51 PM

please clarify ..how many inputs ...???

@admin/any_user: plz provide

paarth @ 26 Feb 2011 08:55 PM

@admin/any_user:

plz provide the data for ip address classes used.....because different sites provide different data....and there is no point in trying to find the correct data (this being a programming / algorithmic contest)...

plz...do provide the required...

@admin: plz do atleast reply

paarth @ 26 Feb 2011 09:11 PM

@admin:

plz do atleast reply to my previous post......

@anish7766 plz...provide the

paarth @ 26 Feb 2011 09:41 PM

@anish7766

plz...provide the data u used for classification...'coz admin is not replying....

Whats with the problem

abhi91_sa @ 26 Feb 2011 09:43 PM

Whats with the problem statement given in the dreamsparkyatra link?It doesnt make sense.What is the input format?When should we terminate the input?

@Amritpal: I am not sure

ganesha @ 26 Feb 2011 09:45 PM

@Amritpal: I am not sure about your TLE. But the Output should not take more than 1 sec(that's the limit). It takes 0.1 sec for my program.

@Anish: Guessing the boundary

ganesha @ 26 Feb 2011 09:47 PM

@Anish: Guessing the boundary inputs and special cases is part of the programming contest. The only authentic source you can rely are on Network Certifications Books/Ebooks/Websites from CISCO/Microsot or Internet Engineering Task Force IETF.

@ALL: Since you people are

ganesha @ 26 Feb 2011 10:25 PM

@ALL: Since you people are having so much trouble to figure it out and this is just a practice contest, I am giving you the exact details of this question:

Class A : 1.0.0.0 - 127.255.255.255

Class B : 128.0.0.0 - 191.255.255.255

Class C : 192.0.0.0 - 223.255.255.255

Class D : 224.0.0.0 - 239.255.255.255

Class E : 240.0.0.0 - 255.255.255.254

Any other input range is 'Invalid'

@Vishal: AFAIK 127.*.*.* is

EgorK @ 27 Feb 2011 02:21 AM

@Vishal:

AFAIK 127.*.*.* is not considered class A ip

hey...plz tell the limits

mist_rock @ 27 Feb 2011 02:24 AM

hey...plz tell the limits yaar.. this is amazing..i have designed the program..but dont know the limits..

@Egor: You are right, I am

ganesha @ 27 Feb 2011 03:17 AM

@Egor: You are right, I am right too. But different Networking Authorites go for different classifications. Some go with 127 as Class A others do not. However, this does not make any difference since, we haven't used any input from that range!

@Rocker: what do you mean by

ganesha @ 27 Feb 2011 03:20 AM

@Rocker: what do you mean by limits? The Input ends with EOF; and I have mentioned classes, even quoted examples. I once again mention that Input File may contain invalid inputs. Please refer to the General Instructions and Announcements in the Contest Page.

There are people from diff Universities who have correctly solved this question - so don't you think fault somewhere lies within your code?

hey.. wat are the number of

abdulqadir791 @ 27 Feb 2011 03:22 AM

hey.. wat are the number of test cases!!??

@abdul i/p ends with EOF

vfix @ 27 Feb 2011 03:27 AM

@abdul i/p ends with EOF

i dont understand the Input

devrajchouhan @ 27 Feb 2011 10:48 AM

i dont understand the Input format ...??? can i  read a file?? ....

@Devraj: You seriously Need

ganesha @ 28 Feb 2011 03:54 PM

@Devraj: You seriously Need to Work on your input taking strategies. Refer any ACM-ICPC site.

Please register your self at

ganesha @ 28 Feb 2011 03:55 PM

Please register your self at http://dreamsparkyatra.mstc-india.com/dspc2011register.html to recieve notices, e-certificates etc.

Solutions and i/p o/p files

ganesha @ 28 Feb 2011 04:12 PM

Solutions and i/p o/p files will be mailed only to contestants who have registered at  http://dreamsparkyatra.mstc-india.com/dspc2011register.html by 2nd March.

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold
CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com