結果

問題 No.219 巨大数の概算
ユーザー TLwiegehtt
提出日時 2015-07-16 09:56:10
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 7 ms / 1,500 ms
コード長 522 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 24,704 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 11:17:41
合計ジャッジ時間 2,831 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d", &n);
      |         ^~~~~~~~~~~~~~~
main.c:22:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |                 scanf("%lf %lf", &a, &b);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main(void)
{
	int i,j,n;
	
	double list[111] ;
	
	for(i=10;i<=100;i++){
		list[i] = log10(1.0*i/10);
	}
	
	scanf("%d", &n);
	
	for(i=0;i<n;i++){
		int s=1, t=0;
		long long int digit;
		double tmp,a,b,y; 
		
		scanf("%lf %lf", &a, &b);
		
		y = log10(a)*b;
		
		digit = floor(y);
		tmp = y-floor(y);
		
		for(j=11;j<=100;j++){
			if(list[j] >= tmp){
				s = (j-1)/10;
				t = (j-1)%10;
				break;
			}
		}
		printf("%d %d %lld\n", s, t, digit);
	}
	return 0;
}
0