/ /

记录详情

Wrong Answer

foo.cc: In function 'int main()':
foo.cc:8:27: warning: unused variable 'k' [-Wunused-variable]
  int a[m],b[n],temp,sum=n,k;
                           ^
正在同步测试数据,请稍后
[Hydro](https://hydro.ac)提供评测服务
# 状态 耗时 内存占用
#1 Wrong Answer Read 966, expect 967. 5ms 392.0 KiB
#2 Accepted 3ms 392.0 KiB
#3 Wrong Answer Read 3, expect 8. 9ms 400.0 KiB
#4 Wrong Answer Read 142, expect 145. 6ms 436.0 KiB
#5 Wrong Answer Read 3, expect 4. 3ms 384.0 KiB
#6 Wrong Answer Read 3, expect 7. 7ms 440.0 KiB
#7 Wrong Answer Read 18, expect 24. 10ms 400.0 KiB
#8 Wrong Answer Read 29, expect 37. 11ms 400.0 KiB
#9 Wrong Answer Read 4, expect 5. 7ms 396.0 KiB
#10 Accepted 2ms 384.0 KiB

代码

#include<iostream>
using namespace std;
int main()
{
	int m,n;
	cin>>m>>n;
	int i,j;
	int a[m],b[n],temp,sum=n,k;
	for(i=0;i<m;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<n;i++)
	{
		cin>>b[i];
	}
	for(i=1;i<m;i++)
	{
		for(j=0;j<=m-i-1;j++)
		{
			if(a[j]<a[j+1])
			{
				temp=a[j];
				a[j]=a[j+1];
				a[j+1]=temp;
			}
		}
	}
		for(i=1;i<n;i++)
	{
		for(j=0;j<=n-i-1;j++)
		{
			if(b[j]<b[j+1])
			{
				temp=b[j];
				b[j]=b[j+1];
				b[j+1]=temp;
			}
		}
	}
	for(j=0;j<m;j++)
	{
		for(i=0;i<n;i++)
		{
		if(a[j]>=b[i]&&b[i]>0)
		{
			a[j]=0;b[i]=0;
			sum--;
		}	
		}
	}
	cout<<sum;
}

信息

递交者
类型
递交
题目
P1009 苹果摘陶陶
题目数据
下载
语言
C++
递交时间
2021-08-11 18:20:44
评测时间
2021-08-11 18:20:44
评测机
分数
20
总耗时
67ms
峰值内存
440.0 KiB