結果

問題 No.571 3人兄弟(その2)
ユーザー funakoshi
提出日時 2019-08-27 17:21:25
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,302 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 31,232 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-15 22:41:29
合計ジャッジ時間 844 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    int height[3]={0};
    int weight[3]={0};
    int rank[3]={0,1,2};
    scanf("%d %d",&height[0],&weight[0]);
    scanf("%d %d",&height[1],&weight[1]);
    scanf("%d %d",&height[2],&weight[2]);
    for(int i=0;i<2;i++)
    {
        for(int j=i+1;j<3;j++)
        {
            if(height[i]<height[j])
            {
                int tmp=rank[i];
                rank[i]=rank[j];
                rank[j]=tmp;
                int temp=height[i];
                height[i]=height[j];
                rank[j]=tmp;
            }
            else if (height[i]==height[j])
            {
                if(weight[i]>weight[j])
                {
                    int tmp=rank[i];
                    rank[i]=rank[j];
                    rank[j]=tmp;
                    int temp=weight[i];
                    weight[i]=weight[j];
                    rank[j]=tmp;
                }
            }
            
        }
    }
    for(int i=0;i<3;i++)
    {
        if(rank[i]==0)
        {
            printf("A");
        }
        else if (rank[i]==1)
        {
            printf("B");
        }
        else
        {
            printf("C");
        }
        printf("\n");
    }
}
0