結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
gogotea
|
| 提出日時 | 2015-03-25 16:50:05 |
| 言語 | Go1.4 (1.4.2) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 471 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 34,048 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 00:11:04 |
| 合計ジャッジ時間 | 702 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
func main() {
N := nextInt()
M := nextInt()
pos := N
for i := 1; i <= M; i++ {
P := nextInt()
Q := nextInt()
switch pos {
case P:
pos = Q
case Q:
pos = P
}
}
fmt.Println(pos)
}
var sc = bufio.NewScanner(os.Stdin)
func next() string {
sc.Split(bufio.ScanWords)
sc.Scan()
return sc.Text()
}
func nextInt() int {
i, e := strconv.Atoi(next())
if e != nil {
panic(e)
}
return i
}
gogotea