提交记录 #504
提交时间:2024-12-17 12:13:42
语言:c
状态:Accepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:8:26: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration]
8 | for(int i=0;i<n;i++) gets(name[i]);
| ^~~~
| fgets
/usr/bin/ld: /tmp/ccrQXGaa.o: in function `main':
code.c:(.text.startup+0x4d): warning: the `gets' function is dangerous and should not be used.
固定测试点#1:
额外测试点#3600:
65【应用】恭喜发财 利是窦来
#include<stdio.h>
#include<string.h>
int n,money[20];
char name[20][20];
int main(){
scanf("%d\n",&n);
for(int i=0;i<n;i++) gets(name[i]);
for(int i=0;i<n;i++){
char temp[20]; gets(temp); int u=0,m,s;
for(;u<n;u++) if(strcmp(temp,name[u])==0) break;
scanf("%d %d",&m,&s); char c=getchar();while(c!='\n') c=getchar();
if(s!=0) money[u]-=(m/s)*s;
for(int j=0;j<s;j++){
char temp2[20]; gets(temp2); int v=0;
for(;v<n;v++) if(strcmp(temp2,name[v])==0) break;
money[v]+=m/s;
}
}
for(int i=0;i<n;i++){
printf("%s %d\n",name[i],money[i]);
}
return 0;
}