No master 1 time limit:MS | Memory limit:65535 KB Difficulty:0
-
Describe
-
son Xiao recently played in the Land of the Lord 1, he has a good evaluation of the game, combining FPS and RPG elements, can play very high. However, he found that a generation of mission system did not do well, the task system did not help him to figure out which area how many tasks, and, to the task, but also more scattered. For example, at a task point in the 1 area, you get 4 quests, 2 A task point in the area, and you get 3 quests; After a while, you get 1 quests in another task point in the 3 area (not completed before), 3 missions are received in the area of the region. He felt very messy, and now he's going to design a program to count the number of tasks in each area.
-
-
Input
-
-
multiple sets of test data to enter 0 0 end
One row per group of data, input m area, n Tasks (0<m,n<100)
-
-
Output
-
-
output statistical results for each region (no sorting required)
-
-
Sample input
-
-
1 32 33 41 70 0
-
-
Sample output
-
1 102 33 4
The topic is very simple, but a bit of pit, be sure to follow the input sequence output
1#include <iostream>2#include <cstdio>3#include <cstring>4 using namespacestd;5 intMain ()6 {7 intn,m,a[ the],j=0, i=0, max=-Ten;8 intb[ the]={0};9Memset (A,0,sizeof(a));Ten while(cin>>n>>m&&! (m==0&&n==0)) One { A if(a[n]==0) -b[i++]=N; -a[n]+=m; the } - for(j=0; j<i;j++) - { -cout<<b[j]<<' '<<a[b[j]]<<Endl; + } -}
The Land of the Lord No 1