2012-04-06から1日間の記事一覧

AOJ 0176 - What Color?

aoj

再びVimで書いた. フォントサイズが小さい dkが同じ数値の場合に対応するために逆順に調べました. #include <iostream> #include <cmath> int hextodec(char h){ int res; if(h >= '0' && h <= '9') res = h - '0'; else res = h - 'a' + 10; return res; } int main(){ int</cmath></iostream>…

AOJ 0158 - Collatz's Problem

aoj

Vimで書いてみた. でも,ヤンクしてもクリップボードに反映されなかった. #include <iostream> int main(){ int n; while(std::cin >> n, n){ int t = 0; while(n != 1){ if(n % 2)n = n * 3 + 1; else n /= 2; t++; } std::cout << t << std::endl; } }</iostream>