fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int num01 = 1;
  13. int sum =0;
  14. int cnt = 2;
  15. int temp = 0;
  16. int sel = 0;
  17. int cal = 0;
  18. int num = 400;
  19. for(int i = 1; num01<=num; i++){
  20. cal = 0;
  21. temp = num01;
  22. while(temp!=0){
  23. sel = num01%10;
  24. temp = temp/10;
  25. if(sel == 5){
  26. cal++;
  27. }
  28. }
  29. if(cal == 0){
  30. sum = sum+num01;
  31.  
  32. }
  33. num01+=(cnt*cnt);
  34. cnt++;
  35. }
  36. System.out.print(sum);
  37. }
  38. }
Success #stdin #stdout 0.08s 50792KB
stdin
Standard input is empty
stdout
480