70求解

P2006 赵神牛的游戏

```cpp #include<bits/stdc++.h> /*#include<windows.h> #include<unistd.h>*/ using namespace std; typedef long long LL; LL k,m,n,a,b; bool flag; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); /*freopen(".in","r",stdin); freopen(".out","w",stdout);*/ //srand(time(NULL)); cin>>k>>m>>n; for(int i=1;i<=m;i++) { cin>>a>>b; if(a==0) { if(b!=0) cout<<i<<" ",flag=true; continue; } if(1ll*k/a*b>=n) cout<<i<<" ",flag=true; } if(!flag) cout<<-1; return 0; } ``` 加了个特判,解决了。
by TBLGyyx @ 2024-04-05 11:00:49


|