2013-02-23から1日間の記事一覧

0590:Available Areas

AOJ

n個の部屋の面積Sが与えられ、S=2xy+x+yが 成り立たない部屋の個数を出力する問題。S=2xy+x+y S-x=(2x+1)y だから (S-x)mod(2x+1)=0 の時面積Sの部屋が作れる。 #include<iostream> #include<cmath> using namespace std; bool is_room(int S){ for(int i=1;i*i<=S;i++) if((S</cmath></iostream>…