結果
問題 |
No.750 Frac #1
|
ユーザー |
|
提出日時 | 2018-12-19 22:44:08 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 469 ms |
コンパイル使用メモリ | 28,672 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-25 08:10:23 |
合計ジャッジ時間 | 1,413 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <stdio.h> #include <stdlib.h> typedef struct { int A, B; } Frac; int comp(const void *a, const void *b) { return ((Frac*)a)->B * ((Frac*)b)->A - ((Frac*)a)->A * ((Frac*)b)->B; } int main(void) { int n, i; Frac frac[10]; scanf("%d", &n); for (i = 0; i < n; ++i) scanf("%d%d", &frac[i].A, &frac[i].B); qsort(frac, n, sizeof(Frac), comp); for (i = 0; i < n; ++i) printf("%d %d\n", frac[i].A, frac[i].B); return 0; }