-
Notifications
You must be signed in to change notification settings - Fork 0
/
A.cpp
63 lines (63 loc) · 1.18 KB
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
int main()
{
int n,i,ara[11],min=0,ans=0,count=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&ara[i]);
}
if(n<=2)
{
for(i=0; i<n; i++)
{
if(ara[i]==ara[0])
count++;
}
if(count==n)
printf("-1");
else
{
for(i=0; i<n; i++)
{
if(i==0)
{
ans=0;
min=ara[0];
}
else
{
if(ara[i]<min)
{
ans=i;
min=ara[i];
}
}
}
printf("1\n");
printf("%d\n",ans+1);
}
}
else
{
for(i=0;i<n;i++)
{
if(i==0)
{
ans=0;
min=ara[0];
}
else
{
if(ara[i]<min)
{
ans=i;
min=ara[i];
}
}
}
printf("1\n");
printf("%d\n",ans+1);
}
return 0;
}