結果

問題 No.219 巨大数の概算
ユーザー Bantako
提出日時 2017-08-24 13:15:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 1,375 ms
コンパイル使用メモリ 166,364 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-15 14:16:51
合計ジャッジ時間 11,718 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   14 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1000000007;
double power(double x,ll n){
    if(n == 0)return 1;
    x /= pow(10,floor(log10(x))); 
    double ans = power(x*x,n/2);
    if(n % 2 == 1)ans *= x;
    ans /= pow(10,floor(log10(ans))); 
    return ans;
}
main(){
    int N;
    cin >> N;
    for(int i = 0;i < N;i++){
        ll A,B;
        cin >> A >> B;
        double digit = log10(A);
        double d = 1.*A/pow(10,floor(digit));
        double ans = power(d,B);
//        cout << d << " " << ans << endl;
        printf("%d %d %d\n",(int)ans,(int)(ans*10)%10,(ll)(digit*B));
    }  
}
0