摘要: System.out.printf("%4d",x); printf("%4d",x); 保留小数点后两位也可以用%.2f 相对来说很好记了 回车用\n 阅读全文
posted @ 2023-02-07 22:17 镰刀战士 阅读(35) 评论(0) 推荐(0)
摘要: package com.ittrash;import java.util.Scanner;public class zzul1074 { public static void main(String[] args) { Scanner input = new Scanner(System.in); 阅读全文
posted @ 2023-02-07 22:12 镰刀战士 阅读(26) 评论(0) 推荐(0)
摘要: import java.util.Scanner;/** * 限制解是正数,且脚数为偶数即可 */public class zzul1073 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); 阅读全文
posted @ 2023-02-07 22:12 镰刀战士 阅读(23) 评论(0) 推荐(0)
摘要: import java.util.Scanner;public class zzul1058 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextIn 阅读全文
posted @ 2023-02-07 22:11 镰刀战士 阅读(28) 评论(0) 推荐(0)
摘要: String.format仅限double类型可用 int类型会报错 double d1 = 6.6666;System.out.println(String.format("%.2f", d1));//设置保留两位小数注意:没有小数位或者小数位不够你设置的保留数时,自动补0 阅读全文
posted @ 2023-02-07 00:31 镰刀战士 阅读(249) 评论(0) 推荐(0)