結果

問題 No.219 巨大数の概算
コンテスト
ユーザー nanasili
提出日時 2015-07-31 16:23:06
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 10 ms / 1,500 ms
コード長 1,119 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 512 ms
コンパイル使用メモリ 105,420 KB
実行使用メモリ 113,032 KB
最終ジャッジ日時 2026-04-02 03:47:08
合計ジャッジ時間 2,988 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;

double mlog10[101];

void solve(double &x, double &y, double &z) {
  double az;
  double t;
  t = modf(y*log10(x), &az);
  for (int i = 1; i < 100; i++) {
    if (mlog10[i] <= t && t < mlog10[i+1]) {
      x = i/10;
      y = i%10;
      break;
    }
  }
  z = az;
}

int main() {
  for (int i = 1; i <= 100; i++) {
    mlog10[i] = log10(double(i)/10.);
  }

  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    double a, b;
    scanf("%lf %lf", &a, &b);

    double x, y, z;
    x = a; y = b; z = 0;
    solve(x, y, z);
    printf("%.0lf %.0lf %.0lf\n", x, y, z);
  }

  // ll x, y, z;
  // scanf("%lld %lld %lld", &x, &y, &z);
  // convert(x, y, z);
  // printf("%lld %lld %lld\n", x, y, z);
}
0