Nyoj 845 "Water"

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.