結果

問題 No.219 巨大数の概算
ユーザー FF256grhy
提出日時 2015-05-30 00:26:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 1,500 ms
コード長 412 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 32,000 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-18 10:54:49
合計ジャッジ時間 2,461 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d%d", &a, &b);
      |                 ~~~~~^~~~~~~~~~~~~~~~

ソースコード

diff #

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

//誤差以前にあってんのか知らん

int main(void) {
	int n, i;
	scanf("%d", &n);
	for(i = 0; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		double d = ( (double) b) * log10(a);
		long long int z = floor(d);
		double base = pow(10, d - floor(d));
		int x = floor(base), y = ( (int) floor(base * 10) ) % 10;
		printf("%d %d %lld\n", x, y, z);
	}
	return 0;
}
0