今晚的腾讯笔试第一题???
第一题的那个电话号,这么写为什么是错的?我理解有问题吗?
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for(int t = 0; t < n; t++){ int x = sc.nextInt(); String str = sc.next(); if(x < 11){ System.out.println("NO"); continue; } int tem = 0; //记录一下8第一次出现的位置 for(int i = 0; i < x; i++){ if(str.charAt(i)=='8'){ tem = i; break; } } if(x-tem>=11){ System.out.println("YES"); } else { System.out.println("NO"); } } sc.close(); } }