测评机: Xeost[5]
得分: 90分
提交日期: 2012-12-8 20:10:00
有效耗时: 1282毫秒
测试结果1: 通过本测试点|有效耗时94ms
测试结果2: 通过本测试点|有效耗时62ms
测试结果3: 通过本测试点|有效耗时63ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时63ms
测试结果6: 通过本测试点|有效耗时62ms
测试结果7: 通过本测试点|有效耗时141ms
测试结果8: 选手程序运行超过时限
测试结果9: 通过本测试点|有效耗时187ms
测试结果10: 通过本测试点|有效耗时563ms
一样的程序。。。。。。。。。。。。。。。。。。。。。。。
状态: Accepted
测评机: Xeond[6]
得分: 100分 [我要评价一下题目~]
提交日期: 2012-12-8 20:13:00
有效耗时: 1328毫秒
测试结果1: 通过本测试点|有效耗时78ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时63ms
测试结果4: 通过本测试点|有效耗时63ms
测试结果5: 通过本测试点|有效耗时156ms
测试结果6: 通过本测试点|有效耗时62ms
测试结果7: 通过本测试点|有效耗时125ms
测试结果8: 通过本测试点|有效耗时203ms
测试结果9: 通过本测试点|有效耗时172ms
测试结果10: 通过本测试点|有效耗时359ms
#include <stdio.h>
#include <malloc.h>
#include <string.h>
typedef char* str;
str s[100001];
long n=0;
int main()
{
void qs(long,long);
str x=(str)malloc(sizeof(char)*25);
while(scanf("%s",x)!=EOF){
s[++n]=x;
x=(str)malloc(sizeof(char)*25);
}
qs(1,n);
long i,j=1;
for(i=2;i<=n;i++)
if(strcmp(s[i],s[i-1])==0)j++;
else{
printf("%s %.4f\n",s[i-1],(float)(j)/(float)(n)*100);
j=1;
}
printf("%s %.4f\n",s[n],(float)(j)/(float)(n)*100);
return 0;
}
void qs(l,r)
long l,r;
{
long i=l,j=r;
str x,t;
x=(str)malloc(sizeof(char)*25); strcpy(x,s[(l+r)>>1]);
t=(str)malloc(sizeof(char)*25);
do{
while(strcmp(s[i],x)<0) i++;
while(strcmp(s[j],x)>0) j--;
if(i<=j){
strcpy(t,s[i]);
strcpy(s[i],s[j]);
strcpy(s[j],t);
i++; j--;
}
}while(i<=j);
if(i<r) qs(i,r);
if(j>l) qs(l,j);
}