結果
| 問題 | 
                            No.501 穴と文字列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-08-06 12:04:13 | 
| 言語 | Go  (1.23.4)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 68 ms / 2,000 ms | 
| コード長 | 914 bytes | 
| コンパイル時間 | 10,381 ms | 
| コンパイル使用メモリ | 231,944 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-19 12:27:00 | 
| 合計ジャッジ時間 | 11,392 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 22 | 
ソースコード
package main
import (
	"bufio"
	"fmt"
	"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--
		fmt.Print(appender)
	}
}