ํฐ์คํ ๋ฆฌ ๋ทฐ
๐ฉ๐ป๐ป ๋ฌธ์
โ๐ป ํ์ด
๐จ Go
package main
import (
"fmt"
"bufio"
"os"
"sort"
)
type userInfo struct {
age int
name string
}
func main() {
var n int
reader := bufio.NewReader(os.Stdin)
fmt.Fscanln(reader, &n)
writer := bufio.NewWriter(os.Stdout)
defer writer.Flush()
var users = make([]userInfo, n)
for i:=0; i<n; i++ {
fmt.Fscanln(reader, &users[i].age, &users[i].name)
}
sort.SliceStable(users, func(i,j int) bool {
return users[i].age < users[j].age
})
for i:=0; i<n;i++ {
fmt.Fprintln(writer, users[i].age, users[i].name)
}
}
728x90
'dev > algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
BOJ / 15650๋ฒ / N๊ณผ M (2) [Go] (0) | 2020.07.20 |
---|---|
BOJ / 15649๋ฒ / N๊ณผ M (1) [Go] (0) | 2020.07.19 |
BOJ / 1181๋ฒ / ๋จ์ด ์ ๋ ฌ [Go] (0) | 2020.07.17 |
BOJ / 11651๋ฒ / ์ขํ ์ ๋ ฌํ๊ธฐ 2 [Go] (0) | 2020.07.14 |
BOJ / 11650๋ฒ / ์ขํ ์ ๋ ฌํ๊ธฐ [Go] (0) | 2020.07.13 |
๋๊ธ
๊ธ ๋ณด๊ดํจ
์ต๊ทผ์ ๋ฌ๋ฆฐ ๋๊ธ
TAG
- ํ๋ก์ด๋์์ฌ
- BFS
- BOJ
- ๋ฐ๋
- go
- Golang
- ์๊ฐ๊ต์ฒด
- dp
- ์ด๋ถํ์
- ballet
- ๋ธ๋ฃจํธํฌ์ค
- ๋ฐฑ์ค
- ๋ชฝ๊ณ ๋๋น
- ๋ถํ ์ ๋ณต
- ์คํ
- ์๊ณ ๋ฆฌ์ฆ
- java
- dfs
- baekjoon
- Algorithm
- AWS
- ๋งฅ๋ถํ๋ก
- MongoDB
- python3
- ์๋ฐ
- ๋งฅ๋ถ
- ๋งฅ๋ถ ์ ๊ทธ๋ ์ด๋
- ํด์๋งต
- Macbook pro 2012 mid 13
- ํ
- Total
- Today
- Yesterday