結果

問題 No.3356 A÷B問題
コンテスト
ユーザー t98slider
提出日時 2025-11-14 21:28:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 196,148 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-14 21:28:12
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<typename T>
T MUL(T a, T b){
    T res;
    return __builtin_mul_overflow(a, b, &res)? std::numeric_limits<T>::max() : res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll a, b;
    cin >> a >> b;
    string ans;
    if(a * b < 0) ans += "-";
    a = abs(a);
    ans += to_string(a / b);
    ans += '.';
    a %= b;
    a += b;
    a %= b;
    for(int i = 0; i < 500; i++){
        a *= 10;
        ll v = a / b;
        ans += to_string(v);
        a -= v * b;
    }
    cout << ans << '\n';
}
0