Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

mrzero717's blog

By mrzero717, 12 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it