ふらっと C#,C♯,C#(初心者用) Part141at TECH
ふらっと C#,C♯,C#(初心者用) Part141 - 暇つぶし2ch150:デフォルトの名無しさん
18/12/26 06:18:38.10 1oivSykz0.net
課題で10進数を2進数の文字列に変換したいのですが、これだとびっくりすくらい遅いです。
速くするにはどうしたらいいでしょうか。
class Program
{
public static void Main(string[] args)
{
string input = Console.ReadLine();
int i = Convert.ToInt32(input);
string output = "";
while(i >= 1)
{
output = output.Insert(0,(i % 2).ToString());
i >>= 1;
}
Console.WriteLine(output);
Console.ReadLine();
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch