結果

問題 No.3358 逆数の小数部分
コンテスト
ユーザー SnowBeenDiding
提出日時 2025-11-14 22:42:11
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 5,034 ms
コンパイル使用メモリ 335,296 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-14 22:42:18
合計ジャッジ時間 6,133 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

int ans;

__int128 mygcd(__int128 a, __int128 b) {
    ans++;
    if (a == b) return 0;
    if (b == 0) {
        return a;
    } else {
        return mygcd(b, a % b);
    }
}

__int128 f(int k) {
    __int128 x = 1;
    rep(i, 0, k) x *= 10;
    return x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    ans = 0;
    ll a, b;
    char c;
    cin >> a >> c;
    if (c == '.')
        cin >> b;
    else {
        b = 0;
    }
    a *= f(to_string(b).size());
    a += b;
    b = f(to_string(b).size());
    mygcd(a, b);
    cout << ans << endl;
}
0