2015-2016 ACM ICPC Baltic Selection Contest
K. Profact
time limit per test:1 second
memory limit per test:256 megabytes
Alice is bored out of her mind by her math classes. She craves for something much more exciting. That is why she invented a new type of numbers, theprofacts. Alice calls a positive integer number a profact if it can be expressed as a product of one or several factorials.
Just today Alice received n bills. She wonders whether the costs on the bills are profact numbers.