diff --git "a/2224020105/\347\254\254\344\270\200\347\253\240/\344\270\244\346\225\260\344\271\213\345\222\214.cpp" "b/2224020105/\347\254\254\344\270\200\347\253\240/\344\270\244\346\225\260\344\271\213\345\222\214.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..a46398c00c696f5160c2aa417447e99aa34ebe72 --- /dev/null +++ "b/2224020105/\347\254\254\344\270\200\347\253\240/\344\270\244\346\225\260\344\271\213\345\222\214.cpp" @@ -0,0 +1,14 @@ +class Solution { +public: + vector twoSum(vector& nums, int target) { + int n = nums.size(); + for (int i = 0; i < n; ++i) { + for (int j = i + 1; j < n; ++j) { + if (nums[i] + nums[j] == target) { + return {i, j}; + } + } + } + return {}; + } +}; \ No newline at end of file diff --git "a/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" "b/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..0af3eb2378928eafb0e0b26fb56b30064ef070ce --- /dev/null +++ "b/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" @@ -0,0 +1,4 @@ +add(long n) +{ + return n*(n+1)/2; +} diff --git "a/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" "b/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..d01f174744888447e5ab736faf82f0c817cff5c1 --- /dev/null +++ "b/2224020105/\347\254\254\344\270\200\347\253\240/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" @@ -0,0 +1,8 @@ +bool primel(long n) +{ + long i; + for (i=2;i twoSum(vector& nums, int target) { + int n = nums.size(); + for (int i = 0; i < n; ++i) { + for (int j = i + 1; j < n; ++j) { + if (nums[i] + nums[j] == target) { + return {i, j}; + } + } + } + return {}; + } +}; \ No newline at end of file diff --git "a/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" "b/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..0af3eb2378928eafb0e0b26fb56b30064ef070ce --- /dev/null +++ "b/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2141-1\357\274\232\346\261\2021~n\347\232\204\350\277\236\347\273\255\346\225\264\346\225\260\345\222\214.cpp" @@ -0,0 +1,4 @@ +add(long n) +{ + return n*(n+1)/2; +} diff --git "a/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" "b/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" new file mode 100644 index 0000000000000000000000000000000000000000..d01f174744888447e5ab736faf82f0c817cff5c1 --- /dev/null +++ "b/\346\225\260\346\215\256\344\270\216\347\273\223\346\236\204\346\225\231\347\250\213/\345\256\236\351\252\2143\357\274\232\346\261\202\347\264\240\346\225\260\347\232\204\344\270\252\346\225\260.cpp" @@ -0,0 +1,8 @@ +bool primel(long n) +{ + long i; + for (i=2;i