70分求助
查看原帖
70分求助
427617
蒟蒻珂学家楼主2021/6/14 15:53
#include <iostream>
using namespace std;
int main(){
    int a[5010] = {0}, n;
    double x, y;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> x >> y;
        for(double j = 1; j <= y; ++j){
            if(a[int(j * x)] == 0){
                a[int(j * x)] = 1;
            }else{
                a[int(j * x)] = 0;
            }
        }
    }for(int i = 1;; i++){
        if(a[i] == 1){
            cout << i;
            return 0;
        }
    }
    return 0;
}

这个是我的代码 我看了一眼题解发现有一段代码和我的十分相似就是这段

#include<bits/stdc++.h>
using namespace std;
int a[2000001],n;
double x,y;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x>>y;
		for(double j=1;j<=y;++j){
			if(a[int(j*x)]==0) a[int(j*x)]=1;
			else a[int(j*x)]=0;
		}
	}
	for(int i=1;;i++){
		if(a[i]==1){
			cout<<i;
			break;
		}
	}
	return 0;
} 

结果我的七十分 后来把这个题解复制上去他的就过了 这是怎么回事呢 糟了复制题解我不会被棕名吧

2021/6/14 15:53
加载中...