質問編集履歴
10
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
```java
|
40
40
|
|
41
|
-
|
41
|
+
boolean flag=false;
|
42
42
|
|
43
43
|
int m = num.get(num.size()-1);
|
44
44
|
|
@@ -46,23 +46,25 @@
|
|
46
46
|
|
47
47
|
if(m%num.get(i)==0) {
|
48
48
|
|
49
|
+
Collections.sort(num);
|
50
|
+
|
49
51
|
System.out.print(fizz.get(i));
|
50
52
|
|
51
53
|
flag=true;
|
52
54
|
|
53
|
-
}else if(flag==false&&m>2)
|
55
|
+
}else if(flag==false&&m>2){
|
54
56
|
|
55
|
-
for(i = 2; i < m-1; i++)
|
57
|
+
for(i = 2; i < m-1; i++){
|
56
58
|
|
57
59
|
if(m % i == 0) {
|
58
60
|
|
59
61
|
System.out.println(m);
|
60
62
|
|
61
|
-
}else
|
63
|
+
}else{
|
62
64
|
|
63
65
|
System.out.println("prime");
|
64
66
|
|
65
|
-
}return
|
67
|
+
}return;
|
66
68
|
|
67
69
|
}
|
68
70
|
|
@@ -70,7 +72,9 @@
|
|
70
72
|
|
71
73
|
System.out.println(m);
|
72
74
|
|
73
|
-
|
75
|
+
return;
|
76
|
+
|
77
|
+
}
|
74
78
|
|
75
79
|
}
|
76
80
|
|
9
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -75,3 +75,23 @@
|
|
75
75
|
}
|
76
76
|
|
77
77
|
```
|
78
|
+
|
79
|
+
###処理メモ
|
80
|
+
|
81
|
+
mがnumの要素で割れる(m%num.get(i))
|
82
|
+
|
83
|
+
→割れた時のnumと同じ要素番号のfizzを出力(fizz.get(i))
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
mがnumで割れないかつmが2より大きい(m%num.get(i)!=0&&m>2)
|
88
|
+
|
89
|
+
→mが素数でなければm
|
90
|
+
|
91
|
+
→mが素数であればprime
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
それ以外
|
96
|
+
|
97
|
+
→mを出力
|
8
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
```java
|
40
40
|
|
41
|
-
|
41
|
+
boolean flag=false;
|
42
42
|
|
43
43
|
int m = num.get(num.size()-1);
|
44
44
|
|
7
コードミス
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,36 +38,40 @@
|
|
38
38
|
|
39
39
|
```java
|
40
40
|
|
41
|
-
|
41
|
+
boolean flag=false;
|
42
42
|
|
43
|
-
|
43
|
+
int m = num.get(num.size()-1);
|
44
44
|
|
45
|
-
|
45
|
+
for(int i=0;i<num.size()-1;i++) {
|
46
46
|
|
47
|
-
|
47
|
+
if(m%num.get(i)==0) {
|
48
48
|
|
49
|
-
|
49
|
+
System.out.print(fizz.get(i));
|
50
50
|
|
51
|
-
|
51
|
+
flag=true;
|
52
52
|
|
53
|
-
|
53
|
+
}else if(flag==false&&m>2) {
|
54
54
|
|
55
|
-
|
55
|
+
for(i = 2; i < m-1; i++) {
|
56
56
|
|
57
|
-
|
57
|
+
if(m % i == 0) {
|
58
58
|
|
59
|
-
|
59
|
+
System.out.println(m);
|
60
60
|
|
61
|
-
|
61
|
+
}else {
|
62
62
|
|
63
|
-
|
63
|
+
System.out.println("prime");
|
64
64
|
|
65
|
-
|
65
|
+
}return ;
|
66
66
|
|
67
|
-
|
67
|
+
}
|
68
68
|
|
69
|
-
|
69
|
+
}else if(flag==false&&m<=2){
|
70
70
|
|
71
|
+
System.out.println(m);
|
72
|
+
|
73
|
+
}return;
|
74
|
+
|
71
|
-
|
75
|
+
}
|
72
76
|
|
73
77
|
```
|
6
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
}return ;
|
62
62
|
|
63
|
-
}
|
63
|
+
}
|
64
64
|
|
65
65
|
}else{
|
66
66
|
|
5
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,23 +50,23 @@
|
|
50
50
|
|
51
51
|
for(i = 2; i < num.size(); i++) {
|
52
52
|
|
53
|
-
if(m % i == 0) {
|
53
|
+
if(m % i == 0) {
|
54
54
|
|
55
|
-
System.out.println(m);
|
55
|
+
System.out.println(m);
|
56
56
|
|
57
|
-
}else {
|
57
|
+
}else {
|
58
58
|
|
59
|
-
System.out.println("prime");
|
59
|
+
System.out.println("prime");
|
60
60
|
|
61
|
-
}return ;
|
61
|
+
}return ;
|
62
62
|
|
63
|
-
}
|
63
|
+
}
|
64
64
|
|
65
|
-
}else{
|
65
|
+
}else{
|
66
66
|
|
67
|
-
System.out.println(m);
|
67
|
+
System.out.println(m);
|
68
68
|
|
69
|
-
}
|
69
|
+
}
|
70
70
|
|
71
71
|
}
|
72
72
|
|
4
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,9 +46,9 @@
|
|
46
46
|
|
47
47
|
System.out.print(fizz.get(i));
|
48
48
|
|
49
|
-
}else if(m%num.get(i)!=0&&m>2) {
|
49
|
+
}else if(m%num.get(i)!=0&&m>2) {
|
50
50
|
|
51
|
-
for(i = 2; i < num.size(); i++) {
|
51
|
+
for(i = 2; i < num.size(); i++) {
|
52
52
|
|
53
53
|
if(m % i == 0) {
|
54
54
|
|
3
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,9 +42,9 @@
|
|
42
42
|
|
43
43
|
for(int i=0;i<num.size()-1;i++) {
|
44
44
|
|
45
|
-
if(m%num.get(i)==0) {
|
45
|
+
if(m%num.get(i)==0) {
|
46
46
|
|
47
|
-
System.out.print(fizz.get(i));
|
47
|
+
System.out.print(fizz.get(i));
|
48
48
|
|
49
49
|
}else if(m%num.get(i)!=0&&m>2) {
|
50
50
|
|
2
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -42,13 +42,13 @@
|
|
42
42
|
|
43
43
|
for(int i=0;i<num.size()-1;i++) {
|
44
44
|
|
45
|
-
if(m%num.get(i)==0) {
|
45
|
+
if(m%num.get(i)==0) {
|
46
46
|
|
47
47
|
System.out.print(fizz.get(i));
|
48
48
|
|
49
49
|
}else if(m%num.get(i)!=0&&m>2) {
|
50
50
|
|
51
|
-
for(i = 2; i < num.size(); i++) {
|
51
|
+
for(i = 2; i < num.size(); i++) {
|
52
52
|
|
53
53
|
if(m % i == 0) {
|
54
54
|
|
1
コードインデント
test
CHANGED
File without changes
|
test
CHANGED
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
}else if(m%num.get(i)!=0&&m>2) {
|
50
50
|
|
51
|
-
for(i = 2; i < num.size(); i++) {
|
51
|
+
for(i = 2; i < num.size(); i++) {
|
52
52
|
|
53
53
|
if(m % i == 0) {
|
54
54
|
|