Palindromic Paths (Gold)
의견: 0
Farmer John's farm is an N x N grid of fields (1 <= N <= 500), each labeled with a letter A..Z.
Each day, Bessie walks from the upper-left field to the lower-right field, each step taking her either one field to the right or one field downward. She keeps track of the string she generates, and gets disoriented if this string is a palindrome.
Please help Bessie determine the number of distinct routes she can take that correspond to palindromes. Different ways of obtaining the same palindrome count multiple times. Print your answer modulo 1,000,000,007.
Line 1: N. The remaining N lines contain the N rows of the grid; each row contains N characters in the range A..Z.
The number of distinct palindromic routes Bessie can take, modulo 1,000,000,007.
palpath.inpalpath.out4
ABCD
BXZX
CDXB
WCBA12Output details: 1x ABCDCBA, 1x ABCWCBA, 6x ABXZXBA, 4x ABXDXBA = 12 routes.
평가 및 의견
Palindromic Paths (Gold)
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Palindromic Paths (Gold)