質問編集履歴
1
コードを書きなおしました
title
CHANGED
File without changes
|
body
CHANGED
@@ -40,29 +40,37 @@
|
|
40
40
|
```C
|
41
41
|
#include<stdio.h>
|
42
42
|
int main(void){
|
43
|
-
|
43
|
+
int a[10000];
|
44
|
-
int i=0,ans,ans1=0;
|
45
|
-
|
44
|
+
int count=1;
|
45
|
+
int ans_num,ans_cnt=0;
|
46
|
+
int i=0,j=0;
|
47
|
+
|
46
|
-
|
48
|
+
while(1){
|
47
|
-
|
49
|
+
if((scanf(" %d",&a[i]))==EOF) break;
|
50
|
+
printf("%d:\n",a[i]);
|
51
|
+
i++;
|
52
|
+
}
|
53
|
+
|
54
|
+
for(j=0;j<i-1;j++){
|
55
|
+
if(j!=0){
|
56
|
+
if(a[j]==a[j-1]){
|
48
|
-
|
57
|
+
count++;
|
49
|
-
|
58
|
+
}
|
50
|
-
|
59
|
+
else{
|
51
|
-
|
60
|
+
if(ans_cnt<=count){
|
52
|
-
|
61
|
+
ans_cnt=count;
|
53
|
-
ans=num[i-1];
|
54
|
-
|
62
|
+
count=1;
|
55
|
-
|
63
|
+
ans_num=a[j-1];
|
56
|
-
|
64
|
+
}
|
57
|
-
|
65
|
+
}
|
58
|
-
i++;
|
59
|
-
|
66
|
+
}
|
60
|
-
if(ans1<=count){
|
61
|
-
ans1=count;
|
62
|
-
ans=num[i-1];
|
63
|
-
printf("%d:%d\n",ans1,ans);
|
64
|
-
|
67
|
+
}
|
68
|
+
|
69
|
+
if(ans_cnt<=count){
|
70
|
+
ans_cnt=count;
|
71
|
+
ans_num=a[j-1];
|
72
|
+
}
|
65
|
-
|
73
|
+
printf("%d %d\n",ans_cnt,ans_num);
|
66
|
-
|
74
|
+
return 0;
|
67
75
|
}
|
68
76
|
```
|