-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIce_cream.c
49 lines (45 loc) · 963 Bytes
/
Ice_cream.c
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
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int * possible(int m, int n, int a[])
{
int i, j;
static int pos[2];
for(i=0; i<n-1; i++)
{ for(j=i+1; j<n; j++)
if (a[i]+a[j]==m)
{
//printf("hai");
pos[0] = i+1;
pos[1] = j+1;
break;
}
}
//printf("%d %d", pos[0], pos[1]);
return pos;
}
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
//return 0;
int tc;
scanf("%d",&tc);
for (int t=0; t<tc; t++)
{
int m;
scanf("%d", &m);
int n;
scanf("%d", &n);
int a[n];
for (int j=0; j<n; j++)
{
scanf("%d", &a[j]);
}
//printf("%d %d",m,n);
int * pos;
pos = possible (m, n, a);
printf("%d ",*pos);
printf("%d\n",*(pos+1));
}
}