/ Randle /

记录详情

Runtime Error

/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);
  ^~~~
# 状态 耗时 内存占用
#1 Wrong Answer 4ms 364.0 KiB
#2 Wrong Answer 3ms 364.0 KiB
#3 Wrong Answer 2ms 360.0 KiB
#4 Runtime Error 5ms 480.0 KiB
#5 Runtime Error 5ms 472.0 KiB
#6 Runtime Error 4ms 512.0 KiB
#7 Runtime Error 4ms 464.0 KiB
#8 Runtime Error 5ms 504.0 KiB
#9 Runtime Error 4ms 492.0 KiB
#10 Runtime Error 4ms 468.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
int n,k;
struct node
{
	double m;
	int s,b;
}a[10001];
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)
	//printf(".2f\n",a[n].m);
	return 0; 
}

信息

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