結果

問題 No.701 ひとりしりとり
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-21 16:49:17
言語 Go
(1.22.1)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 13,186 ms
コンパイル使用メモリ 212,188 KB
実行使用メモリ 8,124 KB
最終ジャッジ日時 2023-10-19 05:27:31
合計ジャッジ時間 12,845 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 <= 12 {
			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