这道题可以不用数组
查看原帖
这道题可以不用数组
1121276
fuxueziyi楼主2024/11/1 21:28
#include<iostream>
using namespace std;
int main(){
	long long n,m,k,a,b,c=0,t=0;
	cin>>k>>m>>n;
	long long x[m]={0};
	for(int i=0;i<m;i++){
		cin>>a>>b;
		if(a<=k and a!=0){
			if(k/a*b>=n){
				cout<<i+1<<" ";
				c=1;
			}
		}
		else if(b!=0 and a==0){
			cout<<i+1<<" ";
			c=1;
		}
	}
	if(c==0)cout<<-1<<endl;
	return 0;
} 
2024/11/1 21:28
加载中...