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; }
本文作者:Ke_scholar
本文链接:https://www.cnblogs.com/Kescholar/p/17399112.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步