UVA Solution 450 – Little Black Book | Volume 4

UVA Onilne Judge Solution UVA-Volume 4

UVA Solution 450 – Little Black Book | Volume 4

UVA Online Judge Solution 450 – Little Black Book | Volume 4
UVA Problem Link – 450 – Little Black Book https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=391

Problem Name: 450 – Little Black Book
Problem Number : UVA – 450 – Little Black Book
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C plus plus

UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list

UVA Solution 400 Code in CPP:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
using namespace std;
struct
Info {
string d[8];
};

int
main() {
int
t;
string depart, info;
map<string, Info> r;
cin >> t;
getchar();
while
(t--) {
getline(cin, depart);
while
(getline(cin, info)) {
if
(info.length() == 0)
break
;
int
pos_1 = 0, pos_2 = info.find(",");
int
idx = 0;
Info p;
while
(1) {
string sub = info.substr(pos_1, pos_2-pos_1);
p.d[idx++] = sub;
pos_1 = pos_2 + 1;
pos_2 = info.find(",", pos_2 + 1);
if
(pos_2 == string::npos) {
sub = info.substr(pos_1, pos_2-pos_1);
p.d[idx++] = sub;
break
;
}
}

p.d[7] = depart;
r[p.d[2]] = p;
}
}

for
(map<string, Info>::iterator i = r.begin(); i != r.end(); i++) {
cout << "----------------------------------------" << endl;
Info p = i->second;
cout << p.d[0] << " " << p.d[1] << " " << p.d[2] << endl;
cout << p.d[3] << endl;
cout << "Department: " << p.d[7] << endl;
cout << "Home Phone: " << p.d[4] << endl;
cout << "Work Phone: " << p.d[5] << endl;
cout << "Campus Box: " << p.d[6] << endl;
}

return
0;
}

Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solver, UVA all problem solution list, UVA 450 code in C, UVA 450 – Little Black Book  code in C++, UVA Little Black Book solution in C, UVA Little Black Book solution

Leave a Reply

Your email address will not be published. Required fields are marked *