結果

問題 No.456 Millions of Submits!
ユーザー くれちー
提出日時 2016-12-07 23:33:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3,377 ms / 4,500 ms
コード長 525 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 31,488 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 03:56:59
合計ジャッジ時間 10,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%lf", &m);
      |         ~~~~~^~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d %d %lf", &a, &b, &t);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cmath>
using namespace std;

int main() {
	double m;
	scanf("%lf", &m);

	int a, b;
	double t, ans;

	for (int i = 0; i < m; i++) {
		scanf("%d %d %lf", &a, &b, &t);
		if (b == 0) ans = pow(t, 1.0 / a);
		else {
			for (double n = 1.0;;) {
				double tmp1 = pow(t, 1.0 / b);
				double tmp2 = pow(n, (double)a / b);
				double tmp3 = n - exp(tmp1 / tmp2);

				if (abs(tmp3) < 10e-10) {
					ans = n;
					break;
				}
				else n -= tmp3 / 4.0;
			}
		}
		printf("%.10lf\n", ans);
	}

	return 0;
}
0