fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool isDigitsDiff(long long a){
  6. int r[10]={0};
  7. while (a>0){
  8. int d=a%10;
  9. if (r[d]==1) return false;
  10. r[d]=1;
  11. a=a/10;
  12. }
  13. return true;
  14.  
  15. }
  16. bool isContain2013(long long a){
  17. while (a>0){
  18. if (a%10000==2013) return true;
  19. a=a/10;
  20. }
  21. return false;
  22. }
  23.  
  24. int main()
  25. {
  26. long long a=0;
  27. while (a<9876543210) {
  28. a=a+2013;
  29. if (isDigitsDiff(a) and isContain2013(a)) {
  30. cout << a << endl;
  31. }
  32. }
  33. }
  34.  
Success #stdin #stdout 1.27s 3340KB
stdin
Standard input is empty
stdout
2013
584720136