mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1057_1408080213.c
This commit is contained in:
parent
bf3396c4ad
commit
82a316ba16
55
QUSTOJ/1057_1408080213.c
Normal file
55
QUSTOJ/1057_1408080213.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include<stdio.h>
|
||||
#include<string.h>
|
||||
int main()
|
||||
{
|
||||
char a[12][20], temp[20], name[20];// name,the number = the name
|
||||
int qian[20],shou[20],song[20];
|
||||
int m, r;// money the number of people
|
||||
int n, i, j, k, l;
|
||||
while(scanf("%d", &n)!=EOF)
|
||||
{
|
||||
for(i=0; i<n ; ++i)
|
||||
{
|
||||
scanf("%s", a[i]);
|
||||
qian[i]=0;
|
||||
}
|
||||
|
||||
for(i=0; i<n; ++i)
|
||||
{
|
||||
scanf("%s", &name);
|
||||
for(l=0; l<n; ++l)
|
||||
{
|
||||
if(strcmp(name,a[l])!=0)
|
||||
continue;
|
||||
else
|
||||
scanf("%d%d", &m, &r);
|
||||
if(r==0)
|
||||
{
|
||||
qian[l]=qian[l]+m;
|
||||
song[l]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
qian[l]= qian[l]+ m%r - m;
|
||||
song[l]= m/r;
|
||||
}
|
||||
for(j=0; j<r; ++j)
|
||||
{
|
||||
scanf("%s", &temp);
|
||||
for(k=0; k<n; ++k)
|
||||
{
|
||||
if(strcmp(temp,a[k])==0)
|
||||
{
|
||||
qian[k]+=song[l];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for(i=0; i<n; ++i)
|
||||
printf("%s %d\n", a[i], qian[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user