Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Taniaaleksandrova avatar Taniaaleksandrova 6 Точки

1. Winning Ticket - Regular Expressions - More Exercise - C# Fundamemtals

Здравейте,

става въпрос за задача 1. Winning Ticket - More Exercise , гърмят ми 6, 7 и 8 тест и не мога да разбера къде е проблема, какъвто и вход да въведа работи правилно, но в judge ми дава 70/100.  Ще съм много благодарна, ако някой ми помогне

Ето коса ми - https://pastebin.com/8h79rbas

Условие

 

Lottery is exciting. What is not, is checking a million tickets for winnings only by hand. So, you are given the task to create a program which automatically checks if a ticket is a winner.

You are given a collection of tickets separated by commas and spaces. You need to check every one of them if it has a winning combination of symbols.

A valid ticket should have exactly 20 characters. The winning symbols are '@', '#', '$' and '^'. But in order for a ticket to be a winner the symbol should uninterruptedly repeat for at least 6 times in both the tickets left half and the tickets right half.

For example, a valid winning ticket should be something like this:

"Cash$$$$$$Ca$$$$$$sh"

The left half "Cash$$$$$$" contains "$$$$$$", which is also contained in the tickets right half "Ca$$$$$$sh". A winning ticket should contain symbols repeating up to 10 times in both halves, which is considered a Jackpot (for example: "$$$$$$$$$$$$$$$$$$$$").

Input

The input will be read from the console. The input consists of a single line containing all tickets separated by commas and one or more white spaces in the format:

  • "{ticket}, {ticket}, … {ticket}"

Output

Print the result for every ticket in the order of their appearance, each on a separate line in the format:

  • Invalid ticket - "invalid ticket"
  • No match - "ticket "{ticket}" - no match"
  • Match with length 6 to 9 - "ticket "{ticket}" - {match length}{match symbol}"
  • Match with length 10 - "ticket "{ticket}" - {match length}{match symbol} Jackpot!"

Constrains

  • Number of tickets will be in range [0 … 100]

Examples

Input

Output

Cash$$$$$$Ca$$$$$$sh

ticket "Cash$$$$$$Ca$$$$$$sh" - 6$

$$$$$$$$$$$$$$$$$$$$, aabb  , th@@@@@@eemo@@@@@@ey

ticket "$$$$$$$$$$$$$$$$$$$$" - 10$ Jackpot!

invalid ticket

ticket "th@@@@@@eemo@@@@@@ey" - 6@

validticketnomatch:(

ticket "validticketnomatch:(" - no match

Тагове:
2
Fundamentals Module
direct avatar direct 15 Точки

Здравей, не мога да тествам кода, защото съм JS, но при тези тестове най-вероятно не си съобразил следните сценарии:

@@th@@@@@@e@@m@@@@@@ - трябва да е 6 резултатът, а не 8

@@@@@@@@@@et@@@@@@@@ - трябва да е 8, а не 10

1
Taniaaleksandrova avatar Taniaaleksandrova 6 Точки

Много благодаря, това ми беше грешката!

2
Elena123456 avatar Elena123456 235 Точки

Hello everybody!

Although with every given input I receive the correct output, I have problem with test- 6,7 and 8 as well.  I get the correct ouput with those inputs too:

@@th@@@@@@e@@m@@@@@@ - 6

@@@@@@@@@@et@@@@@@@@ -  8

Is it possible that Judge gives me only 70/100, because I don't use the second regex to count the max sequences of the repeating symbols? I used two for loops for the left and the right side in order to count the repeating sequences.

https://pastebin.com/phRuc71B

0
Elena123456 avatar Elena123456 235 Точки

 I have just founded one of my mistake- in the last if/else conditions we have to use only:

  • int validTheRepeatingLengthInBothSide = Math.Min(maxRightLengthOfTheSameSequences, maxLeftLengthOfTheSameSequences);

At the moment  I have problem with only test Test #8 (Incorrect answer) 90/100: https://pastebin.com/phRuc71B .

If anybody has any idea about the Test 8 input, please share it. Thanks!

0
26/11/2020 01:09:15
krum_43 avatar krum_43 750 Точки

Здравей Таня,

Имам някакво решение без регекси,което взема 80/100.

При мен също гърмят 6 и 7 тест.

Можеш да го погледнеш ако ти е интересно:

https://pastebin.com/1h2rWLNh

 

1
Elena123456 avatar Elena123456 235 Точки

@ krum_43 ,

благодаря за споделенето решение. Ще го погледна. :)

1
krum_43 avatar krum_43 750 Точки

Здравей Таня,

Имам някакво решение без регекси,което взема 80/100.

При мен също гърмят 6 и 7 тест.

Можеш да го погледнеш ако ти е интересно:

https://pastebin.com/1h2rWLNh

0
30/07/2021 16:07:02
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.