SMU Spring 2023 Contest Round 2(待补
M. Different Billing
#include <map> #include <set> #include <cmath> #include <queue> #include <cstdio> #include <vector> #include <climits> #include <cstring> #include <cstdlib> #include <iostream> #include <algorithm> #define inf 0x3f3f3f3f #define endl '\n' #define int long long using namespace std; const int N = 1e5 + 10, mod = 1e9 +7; //typedef long long ll; typedef pair<int,int> PII; //queue<PII> q1; map<vector<int>, int > mp; vector<int> a; deque<char> s; //priority_queue <int,vector<int>,greater<int> > q2; int n,m,t,k; /* */ void solve() { cin >> n >> m; if(m == 0){ cout << n << ' ' << 0 << ' ' << 0 << endl; return ; } int x = m / 2500 ; for(int i = 0;i <= x;i ++){ int y = (m - i * 2500) / 1000; if((n - x - y ) >= 0 && (i * 2500 + y * 1000 == m)){ cout << n - i - y << ' ' << y << ' ' << i << endl; return; } } cout << -1 << endl; } signed main() { ios::sync_with_stdio(false); cin.tie(0);cout.tie(0); int Ke_scholar = 1; //cin >> Ke_scholar ; while(Ke_scholar--) solve(); return 0; }