解题思路:
注意事项:
参考代码:
package 练习; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String[] aa = sc.nextLine().split("\\."); if(aa[0].equals("End of file")) break; try{ if (f(aa)) { System.out.println("Y"); } else { System.out.println("N"); }} catch(Exception e){ System.out.println("N"); } } } static boolean f(String[] a) { int b[]=new int[a.length]; for (int i = 0; i < a.length; i++) { if(a[i].charAt(0)=='0'){ return false; } } for (int i = 0; i < a.length; i++) { b[i]=Integer.parseInt(a[i]); if(b[i]>255||b[i]<0){ return false; } } return true; } }
0.0分
1 人评分
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:733 |
C二级辅导-同因查找 (C语言代码)浏览:585 |
奖学金 (C++代码)浏览:2008 |
A+B for Input-Output Practice (VI) (C++代码)浏览:417 |
打水问题 (C语言代码)浏览:1072 |
C语言程序设计教程(第三版)课后习题6.3 (C++代码)浏览:963 |
求圆的面积 (C语言代码)浏览:1670 |
最小公倍数 (C语言代码)浏览:1029 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:529 |
核桃的数量 (C语言代码)浏览:872 |