Bessie Goes Moo
의견: 0
Bessie gives FJ the expression (B+E+S+S+I+E)(G+O+E+S)(M+O+O), containing the seven variables B,E,S,I,G,O,M (the "O" is a variable, not a zero). For each variable, she gives FJ a list of up to 500 integer values the variable can possibly take. She asks FJ to count the number of different ways he can assign values to the variables so the entire expression evaluates to a multiple of 7.
The answer can be too large to fit into a 32-bit integer, so use 64-bit integers.
Line 1: an integer N. The next N lines each contain a variable and a possible value for that variable. Each variable appears at least once and at most 500 times; no possible value is listed more than once for the same variable. All possible values are in the range -10^5 to 10^5.
A single integer giving the number of ways FJ can assign values to variables so the expression evaluates to a multiple of 7.
bgm.inbgm.out10
B 2
E 5
S 7
I 10
O 16
M 19
B 3
G 1
I 9
M 22riseoj 작성
출처 올림피아드 > USACO > 2014-2015 > US Open > Silver
평가 및 의견
Bessie Goes Moo
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Bessie Goes Moo