結果

問題 No.219 巨大数の概算
ユーザー tsukimizake774tsukimizake774
提出日時 2015-06-05 15:22:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 14 ms / 1,500 ms
コード長 863 bytes
コンパイル時間 487 ms
コンパイル使用メモリ 65,128 KB
実行使用メモリ 4,520 KB
最終ジャッジ日時 2023-09-25 14:16:43
合計ジャッジ時間 4,128 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,380 KB
testcase_01 AC 14 ms
4,376 KB
testcase_02 AC 14 ms
4,520 KB
testcase_03 AC 13 ms
4,392 KB
testcase_04 AC 13 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 14 ms
4,376 KB
testcase_11 AC 13 ms
4,408 KB
testcase_12 AC 13 ms
4,380 KB
testcase_13 AC 13 ms
4,376 KB
testcase_14 AC 13 ms
4,376 KB
testcase_15 AC 14 ms
4,488 KB
testcase_16 AC 14 ms
4,380 KB
testcase_17 AC 13 ms
4,400 KB
testcase_18 AC 13 ms
4,388 KB
testcase_19 AC 13 ms
4,380 KB
testcase_20 AC 14 ms
4,380 KB
testcase_21 AC 14 ms
4,380 KB
testcase_22 AC 14 ms
4,380 KB
testcase_23 AC 14 ms
4,384 KB
testcase_24 AC 14 ms
4,376 KB
testcase_25 AC 13 ms
4,376 KB
testcase_26 AC 14 ms
4,380 KB
testcase_27 AC 13 ms
4,400 KB
testcase_28 AC 13 ms
4,468 KB
testcase_29 AC 13 ms
4,376 KB
testcase_30 AC 13 ms
4,396 KB
testcase_31 AC 13 ms
4,396 KB
testcase_32 AC 13 ms
4,420 KB
testcase_33 AC 13 ms
4,376 KB
testcase_34 AC 14 ms
4,404 KB
testcase_35 AC 14 ms
4,376 KB
testcase_36 AC 13 ms
4,404 KB
testcase_37 AC 14 ms
4,420 KB
testcase_38 AC 14 ms
4,376 KB
testcase_39 AC 14 ms
4,380 KB
testcase_40 AC 13 ms
4,380 KB
testcase_41 AC 13 ms
4,504 KB
testcase_42 AC 14 ms
4,380 KB
testcase_43 AC 13 ms
4,396 KB
testcase_44 AC 13 ms
4,380 KB
testcase_45 AC 13 ms
4,380 KB
testcase_46 AC 13 ms
4,376 KB
testcase_47 AC 13 ms
4,376 KB
testcase_48 AC 13 ms
4,380 KB
testcase_49 AC 13 ms
4,380 KB
testcase_50 AC 14 ms
4,380 KB
testcase_51 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <vector>
#include <cmath>

using vec = std::vector<long>;

inline void solve (vec & as, vec & bs, vec & xs, vec & ys, vec & zs){
  for(auto i = 0; i<as.size(); ++i){
    auto a = as [i];
    auto  b = bs [i];
    double bloga = log10(a) * b;
    long z = floor(bloga);
    
    zs.push_back(z);

    auto rest = bloga - z;

    auto xy = pow(10, rest);

    auto x = floor(xy);
    auto y = floor(10 * (xy - x));
    xs.push_back(x);
    ys.push_back(y);
  }
}


#ifndef BOOST_TEST_MAIN
int main(int argc, char** argv){
  double n;
  vec as, bs, xs, ys, zs; 
  std::cin >> n;
  
  for(auto i = 0; i<n; ++i){
    int a, b;
    std::cin >> a >> b;
    as.push_back(a);
    bs.push_back(b);
  }

  solve(as, bs, xs, ys, zs);

  for(auto i = 0; i<n; ++i){
    std::cout << xs [i] << " " << ys [i] << " " << zs [i] << "\n";
  }
  
}
#endif
0