#include<bits/stdc++.h> using namespace std; long long x,y; int main(){ cin>>x>>y; long long t=x*9; cout<<min(x,max(y,t)-t)<<" "<<min(y/10,x)<<endl; return 0; }
对于第一问,考虑抽屉原理。
对于第二问,考虑贪心。
#include <bits/stdc++.h> using namespace std; int main() { int x, y; cin >> x >> y; cout << max(0LL, y - 9LL * x) << ' ' << y / 10 << endl; return 0; }
By signing up a CZOJ universal account, you can submit code and join discussions in all online judging services provided by us.
Using your CZOJ universal account