• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Need help in understanding a particular program

 
Ranch Hand
Posts: 106
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Everyone

I was going through some old question papers of Indian National Olympiad in Informatics and came accross this PDF. In Page Number 5 of this PDF, there's this question about periodic strings.
That for example if "110110" is to be considered a string then it is a periodic string which can be represented as "110"^2. And there's this line saying "Report the answer modulo M". This is where I am confused. I get the question and what it is wanting (some what) but I am still confused about how I should start off. I don't know, maybe the logic isn't clear for me. So, if anyone would help me, like provide me with some more examples and explain to me what the question is asking, it would be very kind of you.


Regards,
Ranajoy Saha
 
Saloon Keeper
Posts: 14264
321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems unrelated to me. I don't think the modulo matters, unless there's a way to calculate the result quickly if you know something about the relationship between the number of non-periodic strings and M.

At any rate, you can start out by calculating the number of non-periodic strings, and then just print result % M.
 
Marshal
Posts: 76395
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please show us the complete question (not the PDF please).

Start by working out the problem with pencil and paper, not a computer.
 
This one time, at bandcamp, I had relations with a tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic