Блог пользователя mrzero717

Автор mrzero717, 12 лет назад, По-английски

Any help would be appreciated. There are 2 lines of N1,N2 length (1<=N1,N2<=175) that consist of these 2 chars 'H' and 'G', these lines may intersect at any point, your task is to calculate the sum of (The ways to produce each line)^2 mod 97654321 Input: N1,N2 2nd line consists of N1 chars representing the 1st line 3rd line consists of N2 chars representing the 2nd line Output: one line representing the sum of (The ways to produce each line)^2 mod 97654321 Sample test: input: 2 2 HH HG output: 14 There are 3 ways to produce HHHG  and 2 ways to produce HHGH  and one way to produce HGHH  and so: 3^2+2^2+1^2 = 14

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится