データ型の変換についてまとめました。
今回は整数型から文字列に変換する場合を比較します。
Java
public class Main1 {
public static void main(String[] args) {
// 自分の得意な言語で
// Let's チャレンジ!!
//String line = sc.nextLine();
int A = 437326;
int B = 9085;
int ansA = A / B;
int ansB = A % B;
// ラッパークラスを用いて数値を文字列に変換して出力する
System.out.println(Integer.valueOf(ansA).toString() + " " + Integer.valueOf(ansB).toString());
}
}
Python
A = 437326
B = 9085
ansA = int(A/B)
ansB = A % B
print(str(ansA) + " " + str(ansB))
Pythonの方が楽ですね。