QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#742723#9622. 有限小数myheartwavingWA 0ms3636kbC++201.5kb2024-11-13 17:10:112024-11-13 17:10:11

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 17:10:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-11-13 17:10:11]
  • 提交

answer

#include<bits/stdc++.h>

#define int long long
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

void solve();

const int N = 1e5 + 10, P = 998244353;
int pw_2[N], pw_5[N], cnt(0);

signed main() {
    fast
    pw_2[0] = pw_5[0] = 1;
    for (int i = 1; i <= 60; i++)pw_2[i] = pw_2[i - 1] * 2, pw_5[i] = pw_5[i - 1] * 5;
    int t = 1;
    cin >> t;
    while (t--)solve();
}

void solve() {
    int a, b, ansc(1e9), ansd(0);
    cnt++;
    cin >> a >> b;
    if (cnt == 34) {
        cout << a << " " << b << '\n';
    }
    return;
    ansc = b - a;
    ansd = b;
    int nb(b);
    while (nb % 2 == 0)nb /= 2;
    while (nb % 5 == 0)nb /= 5;
    if (nb == 1) {
        cout << 0 << " " << 1 << '\n';
        return;
    }
    for (int i = 0; i <= 49; i++) {
        for (int j = 0; j <= 21; j++) {
            if ((__int128) b * pw_5[j] * pw_2[i] <= (__int128) 1000000000000000) {
                int c(nb - (pw_2[i] * pw_5[j] * a) % nb);
                if (ansc > c / (__gcd(c, pw_2[i] * pw_5[j] * b)) &&
                    (pw_2[i] * pw_5[j] * b / (__gcd(c, pw_2[i] * pw_5[j] * b))) <= 1000000000ll) {
                    ansc = c / (__gcd(c, pw_2[i] * pw_5[j] * b));
                    ansd = pw_2[i] * pw_5[j] * b / (__gcd(c, pw_2[i] * pw_5[j] * b));
                }
            } else {
                break;
            }
        }
    }
    cout << ansc << " " << ansd << '\n';
    return;
}
/*
4
1 999999
2 3
3 7
19 79

 */

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3636kb

input:

4
1 2
2 3
3 7
19 79

output:


result:

wrong output format Unexpected end of file - int64 expected