60求助
  • 板块P1161 开灯
  • 楼主yanglich
  • 当前回复5
  • 已保存回复5
  • 发布时间2023/8/4 15:18
  • 上次更新2023/11/3 05:57:18
查看原帖
60求助
977222
yanglich楼主2023/8/4 15:18
#include<bits/stdc++.h>
using namespace std;
int n,t[5005],x,c=0;
bool d[2000005];
double a[5005];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>t[i];
		for(int j=1;j<=t[i];j++){
			x=floor(a[i]*j);
			if(d[x]==0){
				d[x]=1;
			}
			else{
				d[x]=0;
			}
		}
		if(t[i]>c){
			c=t[i];
		}
	}
	for(int i=1;i<=c;i++){
		if(d[i]==1){
			cout<<i;
			return 0;
		}
	}
	return 0;
} 
2023/8/4 15:18
加载中...