QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740724 | #9622. 有限小数 | tovi | WA | 0ms | 3532kb | C++14 | 668b | 2024-11-13 11:16:56 | 2024-11-13 11:16:56 |
Judging History
answer
#include <iostream>
using namespace std;
// 将一个数分解质因数,只保留2和5,返回其余部分
int reduceToTwoAndFive(int n) {
while (n % 2 == 0) n /= 2;
while (n % 5 == 0) n /= 5;
return n;
}
int main() {
int T;
cin >> T;
while (T--) {
int a, b;
cin >> a >> b;
// 通过分解b来决定d
int reduced_b = reduceToTwoAndFive(b);
// 如果 reduced_b 为 1,说明 b 已经只含有 2 和 5 的因数
// 我们可以直接选择 d = 1, c = 0
int c = 0;
int d = reduced_b;
cout << c << " " << d << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3532kb
input:
4 1 2 2 3 3 7 19 79
output:
0 1 0 3 0 7 0 79
result:
wrong answer The result is not terminating.(Testcase 2)