提交时间:2026-06-13 14:33:05

运行 ID: 42112

#include <iostream> using namespace std; using i64 = long long; struct Solution { void main() { i64 n; cin >> n; int cnt; for (cnt = 0; n > 1; ++cnt) { if (n % 2 == 0) n >>= 1; else if (n % 3 == 0) (n <<= 1) /= 3; else if (n % 5 == 0) (n <<= 2) /= 5; else { cout << "-1\n"; return; } } cout << cnt << '\n'; } }; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T; cin >> T; while (T-- > 0) Solution().main(); cout << flush; return 0; }