Rosetta Problems

DISCO presents ディスカバリーチャンネルプログラミングコンテスト 2016 Ⅱ

https://atcoder.jp/contests/discovery2016-final/tasks/discovery_2016_final_a