Add tags

Add tags to the following comment
オーソドックスに。C# だとコンパイル時計算って……むりだったような気が……。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
using System;
static class Program {
    static void Main() {
        Console.WriteLine(Bin(01001001));   // 73
        Console.WriteLine(Bin(01101001));   // 105
    }
    static int Bin(uint octet) {
        int digit = 1, bin = 0;
        while(octet != 0) {
            if ((octet % 10) != 0) bin |= digit;
            digit <<= 1;
            octet /= 10;
        }
        return bin;
    }
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...