1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define FLUSH while(getchar()!='\n')
typedef struct{
int id ;
char *name ;
int quota ;
float bonus ;
}USER_INFO ;
USER_INFO *users ;

int main()
{
    int m,n,i,j,tid,tqu,flag;
    scanf("%d",&m); //load case
    users=(USER_INFO*)malloc(sizeof(USER_INFO)*(m+2));
    for(i=0;i<m;i++)
    scanf("%d%s%d%f",&users[i].id,users[i].name,&users[i].quota,&users[i].bonus); //build the data
    FLUSH;
    scanf("%d",&n);   //test case
    for(i=0;i<n;i++)
    {
        scanf("%d%d",&tid,&tqu);
        FLUSH;
        for(j=0;j<m;j++)
        {
            if(tid==users[j].id)
            {
                if(tqu>users[j].quota)
                printf("NOT enOUGH\n");
                else
                printf("%s's bonus is %.1f now\n",users[j].name,users[j].bonus+(tqu*0.0001));
            }
            else
            {
                flag=0;
            }
        }
        if(flag==0)
        printf("NOT exist\n");
    }
  return 0;
}