the land of the Lord No 1
- 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)// The order here is the same as the input sequence of M
- Sample input
-
1 32 33 41 70 0
- Sample output
-
1 102 33 4
-
AC Code:
1#include <stdio.h>2#include <string.h>3 intMain ()4 {5 inta[102],b[103];6Memset (A,0,sizeof(a));//A storage area7memset (b,0,sizeof(b));//B Store the number of tasks per region8 intm,n,p=0;9 while(SCANF ("%d%d", &m,&n) && (m+N))Ten { One if(b[m]==0)//m never met. Aa[p++]=m; -b[m]+=N; - } the for(intI=0; i<p;i++) - { -printf"%d%d\n", A[i],b[a[i]]); - } + return 0; -}
Nyoj 845 "Water"