Skip to content

Instantly share code, notes, and snippets.

@nekolinuxblog
Created November 25, 2022 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nekolinuxblog/2a726af3fb349ebaa68e2d5d257d545c to your computer and use it in GitHub Desktop.
Save nekolinuxblog/2a726af3fb349ebaa68e2d5d257d545c to your computer and use it in GitHub Desktop.
AtCoder用の入出力ルーチン付きテンプレート
/*++++ a code submitted by shunsk2020 +++++++++++++
/\ /ヽ
{/ ̄ ̄ ̄ヽ!
∠__╋__j
AC ヨシ! / (.)八(.) ヽ
{=/(人_)=|´ ̄)`ヽ
\ { {_,ノ ノ //~ `
⊂ ̄ヽ_>―――‐''’,〈 (_)
`ヘ(_ ィ r―‐γ !
_,ノ j | |
{ { ノ /\
\ス ̄ ̄ ̄lしイ\ \
( ̄ ) j / \_j\
 ̄ ̄ ( `ヽ \__)
\__ノ
++++++++++++++++++++++++++++++++++++++++++++++++++*/
package main
import(
"fmt"
"bufio"
"os"
"strconv"
"math"
)
//+++++++++++++++++++++++++++++++++++++++
// 準備用の処理
//+++++++++++++++++++++++++++++++++++++++
var sc = bufio.NewScanner(os.Stdin)
var wr = bufio.NewWriter(os.Stdout)
func init(){
sc.Buffer([]byte{},math.MaxInt64)
sc.Split(bufio.ScanWords)
}
//+++++++++++++++++++++++++++++++++++++++
// main
//+++++++++++++++++++++++++++++++++++++++
func main() {
defer func(){ wr.Flush()}()
//ここに処理を書く
n:=in()
out(n)
}
//+++++++++++++++++++++++++++++++++++++++
// 入力用の関数
//+++++++++++++++++++++++++++++++++++++++
//文字列を読み込む関数
func ins() string {
sc.Scan()
return sc.Text()
}
//Intを読み込む関数
func in() int {
return atoi(ins())
}
// Intを読み込む関数
// 2個の変数にいっぺんで読み込むパターン
func in2() (int,int) {
return atoi(ins()),atoi(ins())
}
// 浮動小数点数を読み込む関数
func infl() float64 {
return atof(ins())
}
//+++++++++++++++++++++++++++++++++++++++
// 出力用の関数
//+++++++++++++++++++++++++++++++++++++++
//改行付き出力
func out(x ...interface{}){
fmt.Fprintln(wr, x...)
}
//フォーマット出力
func outf(s string, x ...interface{}){
fmt.Fprintf(wr, s, x...)
}
//+++++++++++++++++++++++++++++++++++++++
// 変換用の関数
//+++++++++++++++++++++++++++++++++++++++
func atoi(s string) int{
i,e := strconv.Atoi(s)
if e != nil{
panic(e)
}
return i
}
func atof(s string) float64{
f,e := strconv.ParseFloat(s,64)
if e != nil{
panic(e)
}
return f
}
func itoa(i int) string{
return strconv.Itoa(i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment