結果
| 問題 |
No.219 巨大数の概算
|
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2017-06-25 12:48:24 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 24 ms / 1,500 ms |
| コード長 | 498 bytes |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 23,552 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 12:21:12 |
| 合計ジャッジ時間 | 3,501 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 51 |
コンパイルメッセージ
main.c: In function ‘run’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d%d",&a,&b);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<math.h>
void run(void){
int n;
scanf("%d",&n);
while(n>0){
n--;
int a,b;
scanf("%d%d",&a,&b);
double t=b*log10(a);
long long int z;
z=(long long int)t;
double r=t-z;
int x,y,i,j;
double min=1;
for(i=1;i<=9;i++){
for(j=0;j<=9;j++){
if(min>fabs(r-log10(i+0.1*j))){
min=fabs(r-log10(i+0.1*j));
x=i;
y=j;
}
}
}
printf("%d %d %lld\n",x,y,z);
}
return;
}
int main(void){
run();
return 0;
}
akakimidori