2011-03-01から1ヶ月間の記事一覧

POJ 2453

#include <iostream> using namespace std; int countBits(int n) { int count=0; //MSBから順に,立っているかチェック for (unsigned int mask=0x80000000; mask>0; mask>>=1) { if (mask & n) count++; } return count; } int main() { int n; while (true) { cin ></iostream>…

巨大な数を扱う時

変数に入りきらなそうだったら,mod 1000000009とかした値を使うと有効な場合がある.