if you are reading this blog, hi.
I have some problems with the "Div. 7" problem:
Here is the official code (from BledDest):
Code
And here is my c++ code when I try to translate from Python $$$\rightarrow$$$ C++:
Code
But, when I submit my C++ code, it gets the wrong answer on test 2 (on test case 52), you can check: 145516095
If you understand the reason why you can comment under this blog. Thank you very much for your help!
If you want to know the difference between your code and the python one then the difference is that the python one runs from 0 to 9(NOT INCLUDING 10) but yours does include 10 . I think that would fix your problem.
Oh, I really don't know this. Thanks for your opinion.
Update: Yey, that's right. Thank you again <3
Not a problem.
Your code runs for j from 0 to 10 so for example if n==61 then your code will check for 60%7==0, 61%7==0, 62%7==0 and so on till 70%7==0. Now you want the answer to be 63 but since you don't have a break statement at 70 it will it is divisible by 7 so it will update res to be 70 and therefore you might get WA.
So in short to correct your code you can just run for j from 0 to 9