algorithm-go

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub today2098/algorithm-go

:heavy_check_mark: verify/aoj-ALDS1_3_A-stack117.test.go

Depends on

Required by

Verified with

Code

//go:build ignore

// verification-helper: PROBLEM https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/3/ALDS1_3_A

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"

	"github.com/today2098/algorithm-go/algorithm"
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func out(x ...interface{}) {
	fmt.Fprintln(wr, x...)
}

func main() {
	sc.Split(bufio.ScanLines)
	sc.Buffer([]byte{}, math.MaxInt32)
	defer wr.Flush()

	sc.Scan()
	query := strings.Split(sc.Text(), " ")

	st := algorithm.NewStack117()
	for _, elem := range query {
		num, err := strconv.Atoi(elem)
		if err == nil {
			st.Push(num)
		} else {
			if elem == "+" {
				tmp := st.Pop().(int) + st.Pop().(int)
				st.Push(tmp)
			} else if elem == "-" {
				tmp := -st.Pop().(int) + st.Pop().(int)
				st.Push(tmp)
			} else {
				tmp := st.Pop().(int) * st.Pop().(int)
				st.Push(tmp)
			}
		}
	}

	ans := st.Pop().(int)
	out(ans)
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/documentation/build.py", line 71, in _render_source_code_stat
    bundled_code = language.bundle(stat.path, basedir=basedir, options={'include_paths': [basedir]}).decode()
  File "/home/runner/.local/lib/python3.10/site-packages/onlinejudge_verify/languages/user_defined.py", line 68, in bundle
    raise RuntimeError('bundler is not specified: {}'.format(str(path)))
RuntimeError: bundler is not specified: verify/aoj-ALDS1_3_A-stack117.test.go
Back to top page