力扣#1两数之和—暴力版
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector < int > nums;
int num,target;
while (cin >> num) { //注意这里对于输入整数数组的处理
nums.push_back(num);
if (cin.get() == '\n')
break;
}
cin >> target;
for (int i = 0; i<nums.size(); i++) {
if (nums[i] < target) {
for (int j = i + 1; j < nums.size(); j++) {
if (nums[j] == target - nums[i]) {
cout << "[" << i << "," << j << "]" << endl;
return 0;
}
}
}
}
}