2699 is waiting to be solved
This commit is contained in:
commit
3568e8cca6
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
main
|
||||||
|
.vscode
|
12
2699-231124/main.cpp
Normal file
12
2699-231124/main.cpp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#include<bits/stdc++.h>
|
||||||
|
using namespace std;
|
||||||
|
class Solution{
|
||||||
|
public:
|
||||||
|
vector<vector<int>> modifiedGraphEdges(int n, vector<vector<int>>& edges, int source, int destination, int target){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
}
|
34
2824-231124-pass/main.cpp
Normal file
34
2824-231124-pass/main.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include<bits/stdc++.h>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
class Solution{
|
||||||
|
public:
|
||||||
|
int countPairs(vector<int>& nums, int target){
|
||||||
|
const int array_length = 60;
|
||||||
|
const int nums_length = nums.size();
|
||||||
|
int sums[array_length][array_length];
|
||||||
|
int rlt = 0;
|
||||||
|
for(int i = 0 ; i < nums_length;i++){
|
||||||
|
for(int j = i + 1; j < nums_length; j++){
|
||||||
|
if(nums[i]+nums[j] < target){
|
||||||
|
rlt++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rlt;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
Solution example;
|
||||||
|
int target = 0;
|
||||||
|
vector<int> ex1 = {-1,1,2,3,1};
|
||||||
|
target = 2;
|
||||||
|
cout<<example.countPairs(ex1,target)<<endl;
|
||||||
|
vector<int> ex2 = {-6,2,5,-2,-7,-1,3};
|
||||||
|
target = -2;
|
||||||
|
cout<<example.countPairs(ex2,target)<<endl;
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user