#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char s[10005][100005],sl[100005]={0};
char delee[100005];
int sum=0;
void fun(char *s)//经过fun的字符串将成为无'<'形式
{
char *p,*fir,*last;
int times;
p=s;
while(*p!='\0')
{
times=0;
while(*p!='<' && *p!='\0') p++;
if(*p=='\0') break;
fir=p;
while(*p=='<') {p++,times++;}
last=p-1;
if(times<(fir-s)+1)
{
*(fir-times)='\0';
strcat(s,last+1);
p=fir-times;
}
else
{
*s='\0';
strcat(s,last+1);
p=s;
}
}
return;
}
int func(int i)//录入sl并将sl处理为无'<'形式后与s[i]进行比较,返回相同字符数
{
char *p,*q;
int final=0;
gets(sl);
fun(sl);
p=s[i];
q=sl;
while(*p!='\0' && *q!='\0')
{
if(*q==*p) final++;
p++;
q++;
}
return final;
}
int main()
{
int i=0,n,t;
for(i=0;strcmp(s[i-1],"EOF")!=0;i++)
{
gets(delee);
fun(delee);
strcpy(s[i],delee);
}
n=i-1;
i=0;
while(i<n)
{
sum+=func(i);
i++;
}
gets(delee);
while(strcmp(delee,"EOF")!=0) gets(delee);
scanf("%d",&t);
printf("%d",(int)1.0*sum*60/t);
return 0;
}
如题,首先录入s,先录入到delee处理delee之后再strcpy是因为处理之后的delee在第一个'/0'之后仍有非'\0'字符 然后进行func录入并处理为无'<'形式然后与s[i]比较,final是返回值(相同字符数) 求求大佬给掌掌眼QAQ 萌新第一次发帖求助如果格式不对还望大佬指出谅解,这道题好像没有下载数据点,哭了