Codeforces 216A - A. Tiling with Hexagons

216A - Tiling with Hexagons

b*cを一つの固まりとみなす。aの値が増減するとき、b*cの固まりを取り除いた図形のパターンがどのように変換するかを考えた。b*cの固まりを取り除くと、以下の「へ」の字のラインが見えてくる。

f:id:noriok:20120820010100p:plain

calc a b c = (a-1) * (b + c - 1) + b * c

main = do s <- getLine
          let [a, b, c] = map read $ words s :: [Int]
          print $ calc a b c