結果
| 問題 |
No.2087 基数の変換
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-02 11:22:45 |
| 言語 | Go (1.23.4) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 544 bytes |
| コンパイル時間 | 14,897 ms |
| コンパイル使用メモリ | 224,244 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 21:39:20 |
| 合計ジャッジ時間 | 16,744 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 47 WA * 4 |
ソースコード
package main
import (
"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 ans int
w := 1
for {
d := m % n
ans += w * d
m /= n
if m <= 0 {
break
}
w *= 10
}
PrintInt(ans)
}
func nextInt() int {
sc.Scan()
i, _ := strconv.Atoi(sc.Text())
return i
}
func PrintInt(x int) {
defer out.Flush()
fmt.Fprintln(out, x)
}