赞
踩
请求出在 12345678 (含)至 98765432 (含)中,有多少个数中完全不包含 2023。
完全不包含 2023 是指无论将这个数的哪些数位移除都不能得到 2023。例如 20322175, 33220022 都完全不包含 2023,而 20230415, 20193213 则含有 2023(后者取第 1,2,6,8 个数位)。
这是一道结果填空的题,你只需要算出结果后提交即可。本题的结果为一个整数,在提交答案时只填写这个整数,填写多余的内容将无法得分。
- import java.util.HashSet;
-
- public class main3 {
- /*static int ans=98765432-12345678+1;
- static HashSet set=new HashSet();*/
- public static void main(String[] args) {
- /*for(int i=12345678;i<=98765432;i++){
- String str=String.valueOf(i);
- for(int a1=0;a1<=4;a1++){
- if(str.charAt(a1)=='2'){
- for(int a2=a1+1;a2<=5;a2++){
- if(str.charAt(a2)=='0'){
- for(int a3=a2+1;a3<=6;a3++){
- if(str.charAt(a3)=='2'){
- for(int a4=a3+1;a4<=7;a4++){
- if(str.charAt(a4)=='3'){
- set.add(i);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- System.out.println(ans-set.size());*/
- System.out.println(85959030);
- }
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。