結果
| 問題 |
No.219 巨大数の概算
|
| コンテスト | |
| ユーザー |
btk
|
| 提出日時 | 2015-05-30 14:03:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 1,500 ms |
| コード長 | 535 bytes |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 63,280 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 11:04:50 |
| 合計ジャッジ時間 | 4,318 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 51 |
ソースコード
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
#define LL long long
#define ld long double
const LL inf=(LL)1e13;
const ld eps=1e-7;
int main(){
int n;
cin>>n;
while(n--){
ld a,b;
LL x,y,z;
cin>>a>>b;
ld c=b*log10(a);
LL l,h;
l=0,h=inf;
//cout<<c<<endl;
while(h-l>1){
LL m=(l+h)/2;
if(m<c-1.0+eps)
l=m;
else h=m;
}
c-=l;
z=l+1;
l=0,h=100;
while(h-l>1){
LL m=(l+h)/2;
if(log10(m)<c+eps)
l=m;
else h=m;
}
x=l/10;
y=l%10;
cout<<x<<" "<<y<<" "<<z<<endl;
}
return 0;
}
btk