ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1072. Routing

Reading ip and mask on c++
Posted by v13 [Kungur] 21 Jan 2019 14:50
If you write on c++ you can do this:

char dot;
unsigned int x,ip;

ip = 0;

for (int i = 24; i >= 8; i -= 8) {
  cin >> x >> dot;
  x <<= i;
  ip |= x;
}
cin >> x;
ip |= x;
------------------
Now you have ip, same you can read mask.

Edited by author 21.01.2019 14:50

Edited by author 21.01.2019 14:52