質問編集履歴
1
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,6 +28,90 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
```java
|
32
|
+
|
33
|
+
import java.util.*;
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
public class Main {
|
40
|
+
|
41
|
+
public static void main(String[] args) {
|
42
|
+
|
43
|
+
// 自分の得意な言語で
|
44
|
+
|
45
|
+
// Let's チャレンジ!!
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
Scanner sc = new Scanner(System.in);
|
50
|
+
|
51
|
+
int N =sc.nextInt();
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
HashMap<Integer,Integer> kakunin = new HashMap<Integer,Integer>();
|
56
|
+
|
57
|
+
int Max = 0;
|
58
|
+
|
59
|
+
int Max2 = 0;
|
60
|
+
|
61
|
+
for(int j=1;j<=N;j++){
|
62
|
+
|
63
|
+
int a_j=sc.nextInt();
|
64
|
+
|
65
|
+
if(!kakunin.containkey(j)){
|
66
|
+
|
67
|
+
kakunin.get(j,0);
|
68
|
+
|
69
|
+
}else{
|
70
|
+
|
71
|
+
kakunin.get(j,+1);
|
72
|
+
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
if(kakunin.get(j+1)>kakunin.get(j)){
|
78
|
+
|
79
|
+
Max = j;
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
if(kakunin.get(j+1)==Max){
|
84
|
+
|
85
|
+
Max2=kakunin.get(j+1);
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
}
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
System.out.println(Max);
|
94
|
+
|
95
|
+
if(Max2!=0){
|
96
|
+
|
97
|
+
System.out.println(Max2);
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
|
114
|
+
|
31
115
|
HashMapでやろうと思っていたのですが、書いているうちにわからなくなってしまいました。
|
32
116
|
|
33
117
|
他力本願で申し訳ないんですが、お願いします。
|