結果
| 問題 |
No.750 Frac #1
|
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-08-22 10:50:00 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 926 bytes |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 31,360 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 01:50:22 |
| 合計ジャッジ時間 | 1,093 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
char str[200][10]={""};
float ans[100]={0};
float ansorg[100]={0};
int num;
int molecule,denominator;
scanf("%d",&num);
for(int i=0;i<num;i++)
{
scanf("%d %d",&molecule,&denominator);
snprintf(str[i],10,"%d %d",molecule,denominator);
ans[i]=(float)molecule/(float)denominator;
ansorg[i]=ans[i];
}
for(int i=0;i<num-1;i++)
{
for(int j=i+1;j<num;j++)
{
if(ans[i]<ans[j])
{
float tmp = ans[i];
ans[i]=ans[j];
ans[j]=tmp;
}
}
}
for(int i=0;i<num;i++)
{
for(int j=0;j<num;j++)
{
if(ans[i]==ansorg[j])
{
printf("%s\n",str[j]);
}
}
}
}
funakoshi