合并表记录
合并表记录
http://www.nowcoder.com/questionTerminal/de044e89123f4a7482bd2b214a685201
#include <stdio.h> int main(void) { int array[500] = { 0 }; int num1, num2, length; scanf("%d", &length); for (int i = 0; i < length; i++) { scanf("%d %d", &num1, &num2); array[num1] += num2; } for (int i = 0; i < 500; i++) if(array[i]) printf("%d %d\r\n", i, array[i]); return 0; }