/ Randle /

记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(int i=1;i<=n;i++)
     ^~~
/in/foo.cc:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  sort(a+1,a+1+n,com);
  ^~~~
/in/foo.cc:37:23: warning: too many arguments for format [-Wformat-extra-args]
  printf(".2f\n",a[n].m);
                       ^
# 状态 耗时 内存占用
#1 Wrong Answer 3ms 364.0 KiB
#2 Wrong Answer 3ms 376.0 KiB
#3 Wrong Answer 3ms 376.0 KiB
#4 Accepted 44ms 1.852 MiB
#5 Accepted 25ms 1.09 MiB
#6 Wrong Answer 24ms 1.121 MiB
#7 Wrong Answer 25ms 1.117 MiB
#8 Wrong Answer 25ms 1.125 MiB
#9 Wrong Answer 25ms 1.094 MiB
#10 Wrong Answer 24ms 1.109 MiB

代码

#include<bits/stdc++.h>
using namespace std;
int n,k;
struct node
{
	double m;
	int s,b;
}a[100001];
inline const void read(int &x)
{
	x=0;
	char c=getchar();
	while(c<'0'||c>'9') c=getchar();
	while(c>='0'&&c<='9')
	{
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
} 
bool com(node aa,node bb)
{
	return aa.m>bb.m;
}
int main()
{
    read(n);read(k);
    for(int i=1;i<=n;i++)
    	read(a[i].s);
    for(int i=1;i<=n;i++)
    	read(a[i].b);
    for(int i=1;i<=n;i++)
        a[i].m=(double)a[i].s/a[i].b;
	sort(a+1,a+1+n,com);
	if(k==1)
	printf("%.2f\n",a[1].m);
	if(k==n*n/2)
	printf(".2f\n",a[n].m);
	return 0; 
}

信息

递交者
类型
递交
题目
梁山伯与祝英台(原创)
题目数据
下载
语言
C++
递交时间
2017-10-24 21:12:20
评测时间
2017-10-24 21:12:20
评测机
分数
20
总耗时
206ms
峰值内存
1.852 MiB