110A-Nearly Lucky Number, working code not accepted

Правка en3, от NeekT, 2021-01-26 18:11:36

Hello everybody.

If i try the input for test 7 (the number 4744000695826) on my machine i get the right output (YES) but when i submit the code, the test on the same output gives the wrong answer (NO).

Here's my submission for the problem in the title (GNU C11)

#include "stdio.h"

int main(){
  int i,c;
  long long int n;
  scanf("%lld",&n);
  
  for(c=0; n>0; n/=10){
    if((n%10 == 4)||(n%10==7))
      c++;
  }
  
  if((c==4)||(c==7))
    printf("YES");
  else
    printf("NO");
  return 0;
}

I tried to mess around with the % operator but if i use %ld i get the same exact outcome (the problem is solved correctly on my machine but the test run by the online judge gives a different answer), so i tried with %d and at the very least i got some consistency: both my machine and the online judge spit out a clear NO.

Could someone help me figure out what's wrong here?

Here's the link to my latest submission in case you want to check out the full test details https://codeforces.com/problemset/submission/110/105489826

Here's a screenshot for the test on my machine

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский NeekT 2021-01-26 18:11:36 123
en2 Английский NeekT 2021-01-26 18:08:28 0 Uploaded a screenshot for the test on my machine
en1 Английский NeekT 2021-01-26 18:03:52 1142 Initial revision (published)