結果

問題 No.701 ひとりしりとり
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-21 16:48:20
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 14,378 ms
コンパイル使用メモリ 212,608 KB
実行使用メモリ 8,124 KB
最終ジャッジ日時 2023-10-19 05:27:16
合計ジャッジ時間 15,915 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	_, _ = fmt.Scan(&n)

	b := "a"
	for i := 0; i < n; i++ {
		s := toString701(i)
		if i+1 == n {
			s += "n"
		}

		fmt.Println(b + s)

		b = string(s[len(s)-1])
	}
}

func toString701(i int) string {
	str := ""
	for {
		j := i % 25
		if j <= 13 {
			str = string(j+'a') + str
		} else {
			str = string(j+'a'+1) + str
		}
		i /= 25
		if i == 0 {
			break
		}
	}
	return strings.Replace(fmt.Sprintf("%18s", str), " ", "a", -1)
}
0