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