摘要:
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner (System.in); int n = sc.nextInt(); int [
阅读全文
posted @ 2023-05-01 21:29
逆袭怪
阅读(28)
推荐(0)
摘要:
输入样例: 5 输出样例: * *** ***** *** * import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.
阅读全文
posted @ 2023-05-01 18:15
逆袭怪
阅读(39)
推荐(0)
摘要:
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while
阅读全文
posted @ 2023-05-01 17:33
逆袭怪
阅读(24)
推荐(0)
摘要:
####1.一般思路: if (n % 2 == 1)//这是奇数 if (n % 2 == 0)//这是偶数 需要注意的是: 以上代码对于==正数==是成立的; 如果n是==负数==的话,就不成立。 考虑==负数==的情况,完整写法应该是: if (n % 2 == 1 || n % 2 == -
阅读全文
posted @ 2023-05-01 17:02
逆袭怪
阅读(413)
推荐(0)
摘要:
判断数字n是不是质数 import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextIn
阅读全文
posted @ 2023-05-01 15:39
逆袭怪
阅读(17)
推荐(0)
摘要:
###1.求第n项(前77项) ``` import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n =
阅读全文
posted @ 2023-05-01 13:09
逆袭怪
阅读(27)
推荐(0)
摘要:
3个数升序排序 if (a > b) {double t = a; a = b; b = t;} if (a > c) {double t = a; a = c; c = t;} if (b > c) {double t = b; b = c; c = t;} 3个数降序排序 if (a < b)
阅读全文
posted @ 2023-05-01 08:39
逆袭怪
阅读(34)
推荐(0)
摘要:
输入字符串a 一般写法:(a.equals("字符串")) 写工程的时候:("字符串".equals(a)) 2023-05-01 08:18:26 星期一
阅读全文
posted @ 2023-05-01 08:20
逆袭怪
阅读(13)
推荐(0)