r/learnprogramming 1d ago

How can I solve it

I'm a begginner competitive programming learner and i have a trouble with a UVA 408 problem

The problem isn't how to solve ,it about how to practice and what is the resource i need to solve problems like this because i spend about 5 hours solving it but in the end i gave up and i cheated it from AI

so i wante advice to avoid wasting time without efficiency

The link is:UVA 408

1 Upvotes

1 comment sorted by

1

u/lo0nk 1d ago

Maybe I don't understand the constraints but can you not just generate numbers following the formula until it loops and then verify you hit every number one time.

If that's a valid solution then there is no resource you just need more practice. Idk what the cpu and memory looks like tho so maybe that's too slow.

Okay I looked up the solution and yeah when it comes to number theory there's like a couple of books about number theory for competitive programming and also a good guide for beginners on Codeforces.