Advertisement
Hasan1026

Checker

Nov 30th, 2021
1,852
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. char s[10000005];
  5. int main()
  6. {
  7.     double  k;
  8.     int i;
  9.     long long c=0;
  10.  
  11.     while(~scanf("%lf %s", &k,s))
  12.     {
  13.  
  14.  
  15.         long long n=strlen (s);
  16.         c+=n;
  17.         if(c>10000000){
  18.             printf("Invalid Input");
  19.             return 1;
  20.         }
  21.  
  22.         int chk27=0, chk5=0;
  23.         if(k<1e7 && k>0 && k-(int)k==0 && strlen(s)<=1e7 && strlen(s)>0)
  24.         {
  25.             ;
  26.         }
  27.         else
  28.         {
  29.  
  30.  
  31.             puts("Invalid Input");
  32.             return 1;
  33.         }
  34.  
  35.         for (i=0; i<n; i++)
  36.         {
  37.             if(s[i]<'0'|| s[i]>'9')
  38.             {
  39.                 break;
  40.             }
  41.             if (s[i]=='2'||s[i]=='7'){
  42.                 chk27++;
  43.             }
  44.             if (s[i]=='5'){
  45.                 chk5++;
  46.             }
  47.         }
  48.  
  49.         if(i!=strlen(s)|| chk5==0 || chk27==0)
  50.         {
  51.             puts("Invalid Input");
  52.  
  53.             return 1;
  54.         }
  55.  
  56.     }
  57.  
  58.  
  59.     puts("Valid Input");
  60.     return 0;
  61.  
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement