結果
| 問題 | 
                            No.858 わり算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             peroon
                         | 
                    
| 提出日時 | 2019-08-13 14:38:02 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,597 bytes | 
| コンパイル時間 | 8,329 ms | 
| コンパイル使用メモリ | 405,988 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-19 13:26:06 | 
| 合計ジャッジ時間 | 8,803 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 WA * 2 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:63:28: warning: 'p' may be used uninitialized [-Wmaybe-uninitialized]
   63 |     string sub = s.substr(p+1, 50);
      |                           ~^~
main.cpp:53:8: note: 'p' was declared here
   53 |     ll p;
      |        ^
            
            ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) FOR(i, 0, a)
#define ALL(v) (v).begin(), (v).end()
const ll mod = 1e9 + 7;
const ll inf = 1e18;
void vprint(vector<ll> A){
    ll L = A.size();
    FOR(i, 0, L){
        if(i) cout << ' ';
        cout << A[i];
    }
    cout << endl;
}
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
// あえて多倍長整数を使ってみる
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    namespace mp = boost::multiprecision;
    // 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
    using Real = mp::number<mp::cpp_dec_float<1024>>;
    // input
    Real A, B; cin >>A>>B;
    ll AA = (ll)A;
    ll BB = (ll)B;
    
    stringstream ss;
    ss << setprecision(55) << A/B;
    string s;
    if(AA%BB==0){
        s = ss.str() + ".000000000000000000000000000000000000000000000000000000000000000000000000000";    
    }else{
        s = ss.str() + "0000000000000000000000000000000000000000000000000000000000000000000000000000";
    }
    
    ll L = s.size();
    ll p;
    rep(i, L){
        char c = s[i];
        cout << c;
        if(c=='.') {
            p = i;
            break;
        }
    }
    string sub = s.substr(p+1, 50);
    cout << sub;
    
    
    return 0;
}
            
            
            
        
            
peroon