题解 | #合并表记录#
合并表记录
http://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201
function func() {
let line;
while(line = readline()) {
let obj = {};
for (let i = 0; i < parseInt(line); i++) {
let [k, v] = readline().split(' ');
if (obj[k]) {
obj[k] += parseInt(v);
} else {
obj[k] = parseInt(v);
}
}
for (let k in obj ) {
print(k + ' ' + obj[k]);
}
}
}
func();