Skip to content

Commit b5de624

Browse files
committed
day03
1 parent a956883 commit b5de624

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

practice/test/.vscode/launch.json

+7
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7+
{
8+
"type": "java",
9+
"name": "Launch and",
10+
"request": "launch",
11+
"mainClass": "day03.and",
12+
"projectName": "test_a0501e95"
13+
},
714
{
815
"type": "java",
916
"name": "Launch reward",

practice/test/bin/day03/and.class

1.16 KB
Binary file not shown.

practice/test/src/day03/and.java

+39-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,44 @@
11
package day03;
2-
import java.util.Scanner;
32
public class and {
43
public static void main(String[] args) {
5-
System.out.print("s");
4+
int sum = 0;
5+
for (int i = 1; i <= 5; i++) {
6+
sum += i;
7+
}
8+
System.out.println("1-5和为" + sum);
9+
sum = 0;
10+
for (int i = 1; i <= 100; i++) {
11+
if (i%2 == 0) {
12+
sum += i;
13+
}
14+
}
15+
System.out.println("1-100间偶数和为" + sum);
16+
17+
int count = 0;
18+
for (int i = 100; i <= 999; i++) {
19+
int ge = i%10;
20+
int shi = (i%100)/10;
21+
int bai = i/100;
22+
// System.out.println(ge);
23+
// System.out.println(shi);
24+
// System.out.println(bai);
25+
Double a = Math.pow(ge, 3);
26+
Double b = Math.pow(shi, 3);
27+
Double c = Math.pow(bai, 3);
28+
if (i == a + b + c) {
29+
System.out.println(i);
30+
count += 1;
31+
}
32+
}
33+
System.out.println("水仙花数总共有" + count + "个");
34+
35+
double paper = 0.0001;
36+
double zf = 8848.86;
37+
int count1 = 0;
38+
while (paper <= zf) {
39+
paper *= 2;
40+
count1 += 1;
41+
}
42+
System.out.println("需要折叠" + count1 + "次");
643
}
744
}

0 commit comments

Comments
 (0)