結果

問題 No.219 巨大数の概算
ユーザー itezpace
提出日時 2016-06-22 09:16:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 31 ms / 1,500 ms
コード長 581 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 63,548 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 12:14:29
合計ジャッジ時間 3,789 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:12: warning: ‘y’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     char x,y;
      |            ^
main.cpp:29:10: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     char x,y;
      |          ^

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;

int main(){
  ll n,a,b;
  cin>>n;

  for(int i=0; i<n; ++i){
    cin>>a>>b;
    double la,lb,lc,ld;
    la=log10(a);
    lb=la*b;
    ll ib;
    ib=lb;
    lc=lb-ib;
    ld=ib;
    ll z;
    z=ld;
    double d;
    d=pow(10,lc);
    string s;
    s=to_string(d);
    ll ss;
    ss=s.size();
    char x,y;
    if(ss){
      x=s[0];
      if(ss>2){
        y=s[2];
      } else {
        y='0';
      }
    }
    cout<<x<<" "<<y<<" "<<z<<endl;
  }

  return 0;
}
0