2 条题解

  • 0
    @ 2025-5-16 20:04:58
    #include<bits/stdc++.h>
    using namespace std;
    const int N=2e5+5;
    int k;
    int a[N],c[N];
    int main() {
    	cin>>k;
    	for(int i=1; i<=k; i++) {
    		cin>>a[i];
    		c[a[i]]++;
    	}
    	int x=2e9,y=2e9,s=k-2;
    	for(int i=1; i<=k; i++) {
    		if(s%a[i]!=0) continue;
    		int t=s/a[i];
    		if(c[t]>0) {
    			if(a[i]<x) {
    				x=a[i];
    				y=t;
    			}
    		}
    	}
    	cout<< x<<' '<<y;
    	return 0;
    }
    • 0
      @ 2025-3-22 15:13:09
      #include<bits/stdc++.h>
      using namespace std;
      const int N=2e5+5;
      int k;
      int a[N],c[N];
      int main(){
      	cin>>k;
      	for(int i=1;i<=k;i++){
      		cin>>a[i];
      		c[a[i]]++;
      	}
      	int x=2e9,y=2e9,s=k-2;
      	for(int i=1;i<=k;i++){
      		if(s%a[i]!=0) continue;
      		int t=s/a[i];
      		if(c[t]>0){
      			if(a[i]<x){
      				x=a[i];
      				y=t;
      			}
      		}
      	}
      	cout<<x<<' '<<y;
      	return 0;
      }
      
      • 1

      信息

      ID
      160
      时间
      1000ms
      内存
      256MiB
      难度
      9
      标签
      递交数
      8
      已通过
      6
      上传者