結果
問題 | No.2087 基数の変換 |
ユーザー |
|
提出日時 | 2022-10-02 11:26:36 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 689 bytes |
コンパイル時間 | 14,148 ms |
コンパイル使用メモリ | 220,220 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 21:42:37 |
合計ジャッジ時間 | 15,698 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 51 |
ソースコード
package mainimport ("bufio""fmt""os""strconv")var sc = bufio.NewScanner(os.Stdin)var out = bufio.NewWriter(os.Stdout)func main() {buf := make([]byte, 1024*1024)sc.Buffer(buf, bufio.MaxScanTokenSize)sc.Split(bufio.ScanWords)n, m := nextInt(), nextInt()var b []intfor {d := m % nb = append(b, d)m /= nif m <= 0 {break}}var ans stringfor i := len(b) - 1; i >= 0; i-- {ans += strconv.Itoa(b[i])}PrintString(ans)}func nextInt() int {sc.Scan()i, _ := strconv.Atoi(sc.Text())return i}func PrintInt(x int) {defer out.Flush()fmt.Fprintln(out, x)}func PrintString(x string) {defer out.Flush()fmt.Fprintln(out, x)}