bird.c
unknown
plain_text
2 years ago
666 B
12
Indexable
#include <stdio.h> int main() { int a[100000], count = 0; long long int numbers, num1, num2, target; scanf("%lld%lld", &numbers, &target); for (int i = 0; i < numbers; i++) scanf("%d", &a[i]); for (num1 = 0; num1 < numbers; num1++) for (num2 = 1; num2 < numbers; num2++) if (count == 0) if (num2 > num1) if (a[num1] + a[num2] == target) { printf("%lld %lld\n", num1, num2); count++; } if (count == 0) printf("%d\n", -1); return 0; }
Editor is loading...
Leave a Comment