結果

問題 No.750 Frac #1
ユーザー michonz4michonz4
提出日時 2019-12-02 08:47:59
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 20:35:52
合計ジャッジ時間 2,070 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 0 ms
5,376 KB
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 RE -
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 1 ms
5,376 KB
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 0 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 AC 1 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main() {
  int n;
  scanf("%d", &n);

  double arr[n][3];
  for (int i=0; i<n; i++) {
    scanf("%lf %lf", &arr[i][1], &arr[i][2]);
    arr[i][0]=arr[i][1]/arr[i][2];
  }

  double tmp[n];
  for (int i=0; i<n; i++) {
    for (int j=i+1; j<n; j++) {
      if (arr[i][0]<arr[j][0]) {
        for (int k=0; k<n; k++) {
          tmp[k]=arr[i][k];
          arr[i][k]=arr[j][k];
          arr[j][k]=tmp[k];
        }
      } else if (arr[i][0]==arr[j][0] && arr[i][1]<arr[j][1]) {
        for (int k=0; k<n; k++) {
          tmp[k]=arr[i][k];
          arr[i][k]=arr[j][k];
          arr[j][k]=tmp[k];
        }
      } else if (arr[i][0]==arr[j][0] && arr[i][1]==arr[j][1] && arr[i][2]<arr[j][2]) {
        for (int k=0; k<n; k++) {
          tmp[k]=arr[i][k];
          arr[i][k]=arr[j][k];
          arr[j][k]=tmp[k];
        }
      }
    }
  }

  for (int i=0; i<n; i++) {
    printf("%.0lf %.0lf\n", arr[i][1], arr[i][2]);
  }
  return 0;
}
0