fork(3) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int sum=0;
  8. int init=10000000;
  9. int end=99999999;
  10. int *d=0;
  11.  
  12. for (int i=init; i<=end; i++) {
  13. int j=i;
  14. d = new int[10];
  15. while (j>0) {
  16. d[j%10]++;
  17. j/=10;
  18. }
  19. bool repeat = false;
  20. for (int k=0;k<=9;k++) {
  21. if (d[k]>=2) {
  22. repeat=true;
  23. }
  24. }
  25. if (!repeat) {
  26. if (i%3==0)
  27. sum++;
  28. }
  29. delete[] d;
  30. }
  31.  
  32. cout << sum;
  33. return 0;
  34. }
Success #stdin #stdout 4.57s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty