Yousef_Sameh's blog

By Yousef_Sameh, history, 2 months ago, In English

Why in this problem the solution that gets all possible numbers which is less than or equal 3 digits and check if any of them is dividable by 8 is a valid solution ? https://codeforces.com/contest/550/problem/C thanks in advance

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Yousef_Sameh (previous revision, new revision, compare).

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

yes, it's correct. but why ?

for 4 digits, you can write number as 1000 + (some 3 digit number) so observe here, 1000 is divisible by 8, so what's point in taking it ? that's why only 3 digits will matter.