fork download
  1. #include<bits/stdc++.h>
  2. #define pii pair<int, int>
  3. #define endl '\n'
  4. #define pb push_back
  5. #define lli long long int
  6.  
  7. using namespace std;
  8. int main()
  9. {
  10. ios_base::sync_with_stdio(false);
  11. cin.tie(NULL);
  12. cout.tie(NULL);
  13. lli ans=1, i, a, b;
  14. bool five=0, two=0;
  15. cin >> a >> b;
  16. for(i=a+1;i<=b;i++)
  17. {
  18. if(i%2==0) two=1;
  19. if(i%5==0) five=1;
  20. if(five && two) cout<<"0"<<endl, exit(0);
  21. }
  22. for(i=a+1;i<=b;i++) ans *= 1LL*(i%10);
  23. cout<<ans%10<<endl;
  24. return 0;
  25. }
Success #stdin #stdout 0s 15240KB
stdin
0 0
stdout
1