求助
查看原帖
求助
1063828
_Fuhrer_楼主2023/8/16 10:22
#include<bits/stdc++.h>
using namespace std;
int main(){
	int k,n,d,e,p,q;
	cin>>k;
	for(int i=1;i<=k;++i){
		cin>>n>>d>>e;
		for(int i=1;i<=n;++i){
			for(int j=1;j<=n;++j){
				for(int g=n;g>=1;++g){
					if(i*j==n && e*d==(i-1)*(j-1)+1) {
						cout<<i<<" "<<j<<endl;
						continue;
					}
					else if(i*g==n && e*d==(i-1)*(g-1)+1) {
						cout<<i<<" "<<g<<endl;
						continue;
					}
					else {
						cout<<"NO";
						continue;
					}
				}
			}
		}
	}
	return 0;
}

TLE(all

2023/8/16 10:22
加载中...