From 9befed87ce7dc72fe2d2742761f93fc428d13f5b Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Tue, 18 Nov 2025 23:46:16 +0700 Subject: [PATCH] feat(go): add 791A & 600B --- go/600B.go | 34 ++++++++++++++++++++++++++++++++++ go/791A.go | 19 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 go/600B.go create mode 100644 go/791A.go diff --git a/go/600B.go b/go/600B.go new file mode 100644 index 0000000..b29ce6f --- /dev/null +++ b/go/600B.go @@ -0,0 +1,34 @@ +package main + +import ( + "bufio" + "fmt" + "os" + "sort" +) + +func main() { + in := bufio.NewReader(os.Stdin) + var n, m int + fmt.Fscan(in, &n, &m) + + a := make([]int, n) + for i := range a { + fmt.Fscan(in, &a[i]) + } + sort.Ints(a) + + out := bufio.NewWriter(os.Stdout) + for i := 0; i < m; i++ { + var x int + fmt.Fscan(in, &x) + + pos := sort.SearchInts(a, x+1) + + fmt.Fprint(out, pos) + if i+1 < m { + fmt.Fprint(out, " ") + } + } + out.Flush() +} diff --git a/go/791A.go b/go/791A.go new file mode 100644 index 0000000..a301b86 --- /dev/null +++ b/go/791A.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" +) + +func main() { + var a, b int + fmt.Scan(&a, &b) + + years := 0 + for a <= b { + a *= 3 + b *= 2 + years++ + } + + fmt.Println(years) +}