参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int sum = 0; for(int i = 1; i <= n; i++) { if(!judge(i)) sum += i * i; } System.out.print(sum); } public static boolean judge(int a) { if(a % 7 == 0) return true; while(a != 0) { if(a % 10 == 7) return true; a /= 10; } return false; } }
0.0分
8 人评分