蒟蒻40分求助!!!
  • 板块P1161 开灯
  • 楼主hell17o
  • 当前回复5
  • 已保存回复5
  • 发布时间2023/7/28 02:22
  • 上次更新2023/11/3 07:17:37
查看原帖
蒟蒻40分求助!!!
875332
hell17o楼主2023/7/28 02:22

这个思路哪里不对吗,为什么只有40分

#include<iostream>
#include<algorithm>
using namespace std;
const int N=2000010;
int res[N];
int main()
{
	int n;
	cin>>n;
	int c=0;
	while(n--)
	{
		double a;
		int t;
		cin>>a>>t;
		for(int i=1;i<=t;i++)
		{
			
			int z=(int)(a*i);

			res[c++]=z;
		}
	}
	sort(res,res+c);
	//奇数个的数就是答案
	for(int i=1;i<c;i=i+2)//
	{
		if(res[i]!=res[i-1])
		{
			cout<<res[i-1];
			break;
		}
	}
	system("pause");
	return 0;
}
2023/7/28 02:22
加载中...