結果
| 問題 |
No.998 Four Integers
|
| コンテスト | |
| ユーザー |
neko_the_shadow
|
| 提出日時 | 2020-02-28 22:44:26 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,200 bytes |
| コンパイル時間 | 10,863 ms |
| コンパイル使用メモリ | 221,640 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-30 23:10:51 |
| 合計ジャッジ時間 | 11,644 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
package main
import (
"bufio"
"fmt"
"math"
"os"
"sort"
"strconv"
)
func exec(stdin *Stdin, stdout *Stdout) {
a := stdin.ReadInt()
b := stdin.ReadInt()
c := stdin.ReadInt()
d := stdin.ReadInt()
e := []int{a, b, c, d}
sort.Ints(e)
if e[0]+1 == e[1] && e[1]+1 == e[2] && e[2]+1 == e[3] {
stdout.Println("Yes")
} else {
stdout.Println("No")
}
}
func main() {
stdout := NewStdout()
defer stdout.Flush()
exec(NewStdin(bufio.ScanWords), stdout)
}
type Stdin struct {
stdin *bufio.Scanner
}
func NewStdin(split bufio.SplitFunc) *Stdin {
s := Stdin{bufio.NewScanner(os.Stdin)}
s.stdin.Split(split)
s.stdin.Buffer(make([]byte, bufio.MaxScanTokenSize), int(math.MaxInt32))
return &s
}
func (s *Stdin) Read() string {
s.stdin.Scan()
return s.stdin.Text()
}
func (s *Stdin) ReadInt() int {
n, _ := strconv.Atoi(s.Read())
return n
}
func (s *Stdin) ReadFloat64() float64 {
n, _ := strconv.ParseFloat(s.Read(), 64)
return n
}
type Stdout struct {
stdout *bufio.Writer
}
func NewStdout() *Stdout {
return &Stdout{bufio.NewWriter(os.Stdout)}
}
func (s *Stdout) Flush() {
s.stdout.Flush()
}
func (s *Stdout) Println(a ...interface{}) {
fmt.Fprintln(s.stdout, a...)
}
neko_the_shadow