質問編集履歴
1
コードを書きなおしました
test
CHANGED
File without changes
|
test
CHANGED
@@ -82,53 +82,69 @@
|
|
82
82
|
|
83
83
|
int main(void){
|
84
84
|
|
85
|
-
|
85
|
+
int a[10000];
|
86
86
|
|
87
|
-
|
87
|
+
int count=1;
|
88
88
|
|
89
|
-
|
89
|
+
int ans_num,ans_cnt=0;
|
90
90
|
|
91
|
-
|
91
|
+
int i=0,j=0;
|
92
92
|
|
93
|
-
|
93
|
+
|
94
94
|
|
95
|
-
|
95
|
+
while(1){
|
96
96
|
|
97
|
-
|
97
|
+
if((scanf(" %d",&a[i]))==EOF) break;
|
98
98
|
|
99
|
-
|
99
|
+
printf("%d:\n",a[i]);
|
100
100
|
|
101
|
-
|
101
|
+
i++;
|
102
102
|
|
103
|
-
|
103
|
+
}
|
104
104
|
|
105
|
-
ans=num[i-1];
|
106
105
|
|
107
|
-
count=1;
|
108
106
|
|
109
|
-
|
107
|
+
for(j=0;j<i-1;j++){
|
110
108
|
|
111
|
-
|
109
|
+
if(j!=0){
|
112
110
|
|
113
|
-
|
111
|
+
if(a[j]==a[j-1]){
|
114
112
|
|
115
|
-
|
113
|
+
count++;
|
116
114
|
|
117
|
-
|
115
|
+
}
|
118
116
|
|
119
|
-
|
117
|
+
else{
|
120
118
|
|
121
|
-
|
119
|
+
if(ans_cnt<=count){
|
122
120
|
|
123
|
-
|
121
|
+
ans_cnt=count;
|
124
122
|
|
125
|
-
|
123
|
+
count=1;
|
126
124
|
|
127
|
-
|
125
|
+
ans_num=a[j-1];
|
128
126
|
|
129
|
-
|
127
|
+
}
|
130
128
|
|
129
|
+
}
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
if(ans_cnt<=count){
|
138
|
+
|
139
|
+
ans_cnt=count;
|
140
|
+
|
141
|
+
ans_num=a[j-1];
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
printf("%d %d\n",ans_cnt,ans_num);
|
146
|
+
|
131
|
-
|
147
|
+
return 0;
|
132
148
|
|
133
149
|
}
|
134
150
|
|