20240424

791A. Bear and Big Brother

package main

import (
    "fmt"
)

func main() {
    var a int
    var b int
    fmt.Scan(&a, &b)

    counter := 0
    for a <= b {
        counter += 1
        a *= 3
        b *= 2
    }
    fmt.Println(counter)
}

fmt.Scan() to read multiple values into variables.

fmt vs bufio to read stdin

I browsed some web pages and documents but could not find any clear guides or benchmarks, but here are my guesses

bufio is more performance efficient

People on Reddit say that, but I'm not sure at the moment as I haven't tested by myself.

bufio is more flexible

fmt.Scan() or its variants read space-separated values whereas bufio seems to provide many functions to process data.

Conclusion (for me)

There's no strong urge to use bufio. Let's use fmt.Scan to read standard input for now.

Random Thoughts

Competitive Programming

What I don't like about competitive programming is that no one writes code that is understandable from others' perspectives. They don't write comments and don't use descriptive variable names to make it hard to hack (point out bugs) their submissions, and the technique goes against real-life situations.

Color Filter

Life is too vivid. I've enabled Color Filters on my iPhone and MacBook, and now they only display black & white. It helped me reduce time spent on YouTube and others.

iPhone, MacBook: Setting -> Accessibility -> Color Filter

Loneliness

I don't have experience with successful teamwork.

I only did single-player sports (karate, badminton, and pro wrestling) and am jealous of the atmosphere people who play team sports have.

I have found it very difficult to motivate others in the same direction, not only in sports but also in programming or business. I tried to publish mobile applications and simple video games, but my friends seemed not to like the projects.

I just wanted to have a good time in the same way as playing tag when we were in elementary school, but now we got old and have parted ways.

TODO


index 20240423 20240425