結果

問題 No.858 わり算
ユーザー sumochiPsumochiP
提出日時 2019-08-09 21:44:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 166,712 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 08:37:07
合計ジャッジ時間 2,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    lint a, b;
    cin >> a >> b;
    string s = "";
    s += to_string(a / b);
    s += ".";

    lint ans, tmp;

    REP(i,50){
        tmp = a % b;
        tmp *= 10;
        a = tmp;
        s += to_string(tmp / b);

    }
    cout<< s << "\n";
    return 0;
}
0