結果
問題 |
No.501 穴と文字列
|
ユーザー |
|
提出日時 | 2020-08-06 12:03:20 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 903 bytes |
コンパイル時間 | 13,084 ms |
コンパイル使用メモリ | 234,520 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 12:25:28 |
合計ジャッジ時間 | 9,902 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 22 |
ソースコード
package main import ( "bufio" "os" "strconv" "strings" ) var sc = bufio.NewScanner(os.Stdin) func NextLine() string { sc.Scan() return sc.Text() } func NextInt() int { a, _ := strconv.Atoi(NextLine()) return a } /** * スペース区切りで文字列を受け取って整数を2個返す */ func GetTwoInts() (a int, b int) { str := strings.Split(NextLine(), " ") a, _ = strconv.Atoi(str[0]) b, _ = strconv.Atoi(str[1]) return } func main() { N, D := GetTwoInts() sToAABBCC(N, D) } /** * 文字列 */ func sToAABBCC(N int, D int) { appender := "A" //最後の桁が2か1か0になれば良い //効率化の手段として残り桁数が3のとき残り数値が3ならAで埋めれば良い、残り数値が6ならBで埋めれば良い for i:=0; i< N; i++ { if D == 2 * (N - i){ appender = "B" }else if D == 0 { appender = "C" } D-- print(appender) } }