darshshounmay2000's blog

By darshshounmay2000, history, 4 years ago, In English

Its to bring in concern of jury of codeforces that in that problem if a number is divisible completely by some lucky number then our output must be YES..Its given that maximum range of number is 1000..So numbers like 447*2<1000 or 477*2<1000 must give output as YES..But codeforces has no test cases as such..Codeforces is accepting solution which prints YES for lucky numbers and numbers that are divisible by 4 or 7 or 47 ..and remaining as NO..But logically numbers divisible not only by 4 or 7 or 47 but also by 74,447,477,474 as lucky numbers greater than that will have multiples greater than 1000..... So test cases such as 74*2,74*3,447*2 and so on must be there ... So a C+++ code for this could be like:

include

using namespace std;

int main() { int n; cin >> n; bool check = false; for (int i = n; i > 0; i /= 10) { if (i % 10 == 4 || i % 10 == 7) { check = true; } else { check = false; break; } } if (check) { cout << "YES"; return 0;

}
else if (n % 4 == 0 || n%7==0 || n%47==0||n%74==0||n%447==0||n%474==0||n%477==0)//AS MAX RANGE OF n is 1000

{ cout << "YES";

}
else {
    cout << "NO";
}

} This solution is accepted but divisibility upto 47 is also accepted which must not be.. So the test cases have to be changed

  • Vote: I like it
  • -18
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

i mean i see your point after looking at your submissions but its a super old div2a