結果
| 問題 | 
                            No.750 Frac #1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             funakoshi
                         | 
                    
| 提出日時 | 2019-08-22 10:48:45 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 943 bytes | 
| コンパイル時間 | 611 ms | 
| コンパイル使用メモリ | 31,360 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-12 01:49:17 | 
| 合計ジャッジ時間 | 1,557 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | WA * 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];
    }
    printf("\n");
    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