Submission #5458441


Source Code Expand

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
	stdout     *bufio.Writer
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// readString() string
// readInt() int
// readInt64() int64
// readFloat64() float64

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	S := readInt()
	x := S / 100
	y := S % 100
	//eprintln(x, y)

	if mm(x) && yy(y) && yy(x) && mm(y) {
		println("AMBIGUOUS")
		return
	}
	if yy(x) && mm(y) {
		println("YYMM")
		return
	}
	if mm(x) && yy(y) {
		println("MMYY")
		return
	}
	println("NA")
}

func mm(a int) bool {
	if 1 <= a && a <= 12 {
		return true
	}
	return false
}

func yy(a int) bool {
	return true
}

// -----------------------------------------------------------------------------

Submission Info

Submission Time
Task B - YYMM or MMYY
User ktateish
Language Go (1.6)
Score 200
Code Size 2094 Byte
Status AC
Exec Time 1 ms
Memory 640 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 10
Set Name Test Cases
Sample 01.txt, 02.txt, 03.txt
All 01.txt, 02.txt, 03.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt
Case Name Status Exec Time Memory
01.txt AC 1 ms 640 KiB
02.txt AC 1 ms 640 KiB
03.txt AC 1 ms 640 KiB
11.txt AC 1 ms 640 KiB
12.txt AC 1 ms 640 KiB
13.txt AC 1 ms 640 KiB
14.txt AC 1 ms 640 KiB
15.txt AC 1 ms 640 KiB
16.txt AC 1 ms 640 KiB
17.txt AC 1 ms 640 KiB