結果

問題 No.858 わり算
ユーザー motimoti
提出日時 2020-05-08 03:32:01
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,490 bytes
コンパイル時間 4,433 ms
コンパイル使用メモリ 228,032 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 15:07:50
合計ジャッジ時間 4,946 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

namespace mp = boost::multiprecision;

int main() {
  mp::cpp_dec_float_100 A, B;
  cin >> A >> B;
  stringstream ss;
  ss << std::setprecision(51) << A / B;
  string s;
  ss >> s;
  int precision = 0;
  bool has_precision = 0;
  rep(i, s.size()) {
    cout << s[i];
    if (has_precision) {
      precision++;
      if (precision == 50) {
        break;
      }
    }
    if (s[i] == '.') {
      has_precision = 1;
    }
  }
  if (!has_precision) {
    cout << ".";
  }
  if (precision < 50) {
    rep(i, 50 - precision) cout << 0;
  }
  cout << "\n";
}
0