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); ^
代码
#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