結果

問題 No.750 Frac #1
コンテスト
ユーザー ゆうP
提出日時 2024-05-04 20:07:13
言語 Go
(1.27.0 + ACL)
コンパイル:
/usr/bin/go_c
実行:
./Main
結果
AC  
実行時間 1 ms / 1,000 ms
+ 575µs
コード長 501 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,743 ms
コンパイル使用メモリ 264,172 KB
実行使用メモリ 9,904 KB
最終ジャッジ日時 2026-09-30 07:43:11
合計ジャッジ時間 12,211 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// No.750 Frac #1
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)

	type target struct {
		molecule    int
		denominator int
		decimal     float64
	}
	t := make([]target, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&t[i].molecule, &t[i].denominator)
		t[i].decimal = float64(t[i].molecule) / float64(t[i].denominator)
	}

	sort.Slice(t, func(i, j int) bool {
		return t[i].decimal > t[j].decimal
	})

	for _, tt := range t {
		fmt.Println(tt.molecule, tt.denominator)
	}
}
0