2 条题解
-
1
#include<queue> #include<math.h> #include<stdio.h> #include<iostream> #include<vector> #include<iomanip> #include<string.h> #include<algorithm> #include<cmath> #include<cstdio> #include<utility> #include<cstring> #include<stack> #include<fstream> #include<string> using namespace std; typedef long long ll; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; void solve() { int Q; cin >> Q; while ( Q-- ) { ll a; cin >> a; if ( a == 0 ) { cout << "0 0\n"; continue; } ll mx = -1 , my = -1; for ( ll y = 0 ; 5 * y <= a ; ++y ) { ll rem = a - 5 * y; if ( rem >= 0 && rem % 3 == 0 ) { mx = rem / 3; break; } } for ( ll x = 0 ; 3 * x <= a ; ++x ) { ll rem = a - 3 * x; if ( rem >= 0 && rem % 5 == 0 ) { my = rem / 5; break; } } if ( mx == -1 || my == -1 ) { cout << "-1\n"; } else { cout << mx << " " << my << "\n"; } } } int main() { solve(); return 0; }
信息
- ID
- 2984
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- 递交数
- 149
- 已通过
- 35
- 上传者