Educational Codeforces Round 90 (Rated for Div. 2)A
A - Donut Shops
题解:
1.我们首先特判一下包装盒里面只有一个物品的情况,如果只装了一个物品,那我们就直接比较这两个物品的单价即可。
2.如果盒子里面装的不止是一键物品,那么我们就需要比较一下之间的单价了,如果价格相等,那么第一件物品肯定有优势(因为它可以一个一个卖),输出1 -1即可;如果第一件价格小于第二件价格,那么第二件物品就会“一无是处”,直接输出1 -1即可,如果第一件物品价格小于第二件物品价格,且单价要大于第二件物品,那么就可以输出1 b。(恰好为b件,肯定买第二件物品话算,因为单价低)
/*Keep on going Never give up*/ #pragma GCC optimize(3,"Ofast","inline") #include <bits/stdc++.h> const int maxn = 2e5+10; const int MaxN = 0x3f3f3f3f; const int MinN = 0xc0c0c00c; typedef long long ll; const int mod = 100000000; using namespace std; int main() { ll a,b,c,t; cin>>t; while(t--){ cin>>a>>b>>c; if(b==1){ if(a>b) cout<<"-1 1"<<endl; else if(a<b) cout<<"1 -1"<<endl; else cout<<"-1 -1"<<endl; } else{ if(a<c){ cout<<"1 "; if(a*b<=c) cout<<-1<<endl; else cout<<b<<endl; } else{ cout<<-1<<" "; cout<<b<<endl; } } } return 0; }
题解 文章被收录于专栏
主要写一些题目的题解