結果
問題 | No.750 Frac #1 |
ユーザー |
![]() |
提出日時 | 2019-02-19 12:45:21 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 421 bytes |
コンパイル時間 | 10,996 ms |
コンパイル使用メモリ | 236,412 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 22:05:31 |
合計ジャッジ時間 | 12,263 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
package main import ( "fmt" "sort" ) type Fraction struct { M, D float64 } func main() { var n int _, _ = fmt.Scan(&n) nums := make([]Fraction, n) for i := range nums { var a, b float64 _, _ = fmt.Scan(&a, &b) nums[i] = Fraction{a, b} } sort.Slice(nums, func(i, j int) bool { return nums[i].M/nums[i].D > nums[j].M/nums[j].D }) for _, f := range nums { fmt.Printf("%.0f %.0f\n", f.M, f.D) } }