結果

問題 No.456 Millions of Submits!
ユーザー akakimidori
提出日時 2017-06-21 11:28:01
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 877 ms / 4,500 ms
コード長 597 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 23,680 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 03:15:01
合計ジャッジ時間 8,042 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘run’:
main.c:23:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   23 |   scanf("%d",&m);
      |   ^~~~~~~~~~~~~~
main.c:28:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   28 |     scanf("%d%d%lf",&a,&b,&t);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<math.h>

double calc(int a,int b,double t){
  if(a==0) return exp(pow(t,(double)1/b));
  if(b==0) return pow(t,(double)1/a);

  double x=log(10);
  double lt=log(t);
  int i;
  for(i=0;i<10;i++){
    double ae=a*exp(x);
    double f=ae+b*x-lt;
    double g=ae+b;
    x-=f/g;
    if(f/g<1e-10) break;
  }
  return exp(exp(x));
}

void run(void){
  int m;
  scanf("%d",&m);
  int i;
  for(i=0;i<m;i++){
    int a,b;
    double t;
    scanf("%d%d%lf",&a,&b,&t);
    double ans=calc(a,b,t);
    printf("%.9lf\n",ans);
  }
  return;
}

int main(void){
  run();
  return 0;
}
0