結果

問題 No.441 和か積
コンテスト
ユーザー 💕💖💞
提出日時 2016-11-18 06:22:08
言語 Go
(1.25.7)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,283 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 15,426 ms
コンパイル使用メモリ 291,064 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-03-14 08:04:58
合計ジャッジ時間 15,929 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

import (
        "bufio"
        "fmt"
        _ "math"
        "math/big"
        "os"
        _ "strconv"
        "strings"
)

func main() {
        scanner := bufio.NewScanner(os.Stdin)
        holder := []big.Int{}
        th := 0
        for scanner.Scan() {
                th += 1
                text := scanner.Text()
                for _, x2 := range strings.Split(text, " ") {
                        bigint := *big.NewInt(0)
                        bigint.SetString(x2, 10)
                        holder = append(holder, bigint)
                }
                if th == 1 {
                        break
                }
        }
        a, b := holder[0], holder[1]
        //fmt.Printf("a %v\n", &a)
        //fmt.Printf("b %v\n", &b)
        op1 := big.NewInt(0)
        op2 := big.NewInt(0)
        op1.Add(&a, &b)
        op2.Mul(&a, &b)
        //fmt.Printf("cmp %v\n", add.Cmp(mul))
        //fmt.Printf("add %v\n", add)
        //fmt.Printf("mul %v\n", mul)

        if op1.Cmp(op2) == 1 {
                fmt.Printf("S")
                fmt.Println()
        } else if op1.Cmp(op2) == -1 {
                fmt.Printf("P")
                fmt.Println()
        } else {
                fmt.Printf("E")
                fmt.Println()
        }
}
0