Lily has a chocolate bar that she wants to share it with Ron for his birthday. Each of the squares h
Lily has a chocolate bar that she wants to share it with Ron for his birthday. Each of the squares has an integer on it. She decides to share a contiguous segment of the bar selected such that the length of the segment matches Ron's birth month and the sum of the integers on the squares is equal to his birth day. You must determine how many ways she can divide the chocolate.
Consider the chocolate bar as an array of squares,s=[2,2,1,3,2] . She wants to find segments summing to Ron's birth day, d=4 with a length equalling his birth month, . In this case, there are two segments meeting her criteria:[2,2] and [1,3].
Function Description
Complete the birthday function in the editor below. It should return an integer denoting the number of ways Lily can divide the chocolate bar.
birthday has the following parameter(s):
- s: an array of integers, the numbers on each of the squares of chocolate
- d: an integer, Ron's birth day
- m: an integer, Ron's birth month
Input Format
The first line contains an integer , the number of squares in the chocolate bar.
The second line contains space-separated integers s[i] , the numbers on the chocolate squares where 0<=i The third line contains two space-separated integers, d and m, Ron's birth day and his birth month.
Constraints
- 1<=10n<=100
- ,1<=s[i]<=5 where (0<=i
- 1<=d<=31
- 1<=m<=12
Output Format
Print an integer denoting the total number of ways that Lily can portion her chocolate bar to share with Ron.
Sample Input 0
5 1 2 1 3 2 3 2
Sample Output 0
2
Cheetah
13th November 2025
Find the best hoodies in Pakistan in cool designs and cozy fabrics. Perfect fit, premium quality, and affordable prices await!
Cheetah
13th November 2025
Discover comfy and stylish hoodies for men made for everyday wear. Explore top designs and shop online in Pakistan today!
Servis
12th November 2025
Step up your style game with the latest collection of Men Peshawari from Servis. Discover the perfect blend of tradition and modern comfort with our range of premium quality footwear. Shop now and enjoy exclusive offers on your purchase.
Brisk
11th November 2025
Discover the best casual shirts for men designed for comfort and style. Choose from modern fits and soft fabrics perfect for daily wear.
Grow
11th November 2025
Delicious and masala pancake for kids made with natural ingredients. A perfect breakfast or snack packed with flavor and nutrition.
Adoro
10th November 2025
Discover the latest collection of stylish bags for women at Adoro. Shop now and elevate your accessory game with our chic designs.
Shop
10th November 2025
Discover the latest Trousers Design at ECS. Our collection features the best styles and colors to suit any occasion. Shop now and enjoy our great offers on women's trousers.
Jahangir
1st July 2025
From vibrant colors to elegant embellishments, explore the most loved Spunkz slippers for women in Pakistan. Comfort meets charm when you shop at Spunkz Footwear.
sara
27th May 2025
Awesome write-up! I started using Telegram Web for work and it's been a total productivity boost. I love how all my chats stay in sync with my phone. Your step-by-step guide was spot-on. Keep sharing tools that make online communication smoother—this kind of content is much appreciated!
sara
16th May 2025
This is exactly why I love downloading audio from YouTube! I use this MP3 site to save tracks like this. It’s fast, doesn’t require an account, and the quality’s always good. Just passing it along in case anyone needs it.
aliza
12th May 2025
I used to think any water bowl would do, but switching to a cat water fountain changed my mind. It’s quieter than I expected, easy to clean, and my cat immediately took to it. Continuous water flow really encourages drinking—definitely a must-have for picky drinkers!
alex
22nd April 2025
Great stuff – thanks for sharing! I’ve bookmarked this for later. Also, for those who love downloading videos, vidmate apk is a fantastic app I’d recommend. It’s fast, free, and packed with features. Been using it to store all my favorite content offline. Definitely worth exploring!
seo
12th March 2025
What a sensational blog! This blog is too much amazing in all aspects. Especially, it looks awesome and the content available on it is utmost qualitative. StreamEast
james
04-04-2025 00:00This <a href="https://birthdaygenerator.org/">birthday generator for characters</a> is an easy-to-use tool that quickly generates random birthdays, saving you time and effort when creating character profiles. Instead of spending time brainstorming, you can customize the inputs to suit your needs and get results tailored to your project. Whether you're a writer developing characters, a developer creating dummy data, or simply testing an app, this tool provides realistic and diverse birthdays with just a few clicks.
sara
7th February 2025
This information about Pakistani Asian clothing is greatly appreciated. They stand out in the global market thanks to their distinctive fusion of modern fashion and traditional artistry. Pakistani Asian Clothes offers a stunning selection of ensembles that elegantly and sophisticatedly celebrate heritage, ranging from colorful casual wear to opulent formal wear.
Aqua
8th December 2024
Upgrade to an efficient RO plant installation with Aquafiltrum. Our systems guarantee high-quality filtration for the best drinking water every day. Explore our expert services, including water filters for home, RO systems, water purification, and wastewater treatment.
Please rotate your device
We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site