diff --git a/.vscode/settings.json b/.vscode/settings.json index 0cba2e6..9d29497 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,21 @@ { "files.associations": { - "iostream": "cpp" + "iostream": "cpp", + "ostream": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "set": "cpp", + "random": "cpp", + "fstream": "cpp", + "functional": "cpp", + "future": "cpp", + "istream": "cpp", + "limits": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "streambuf": "cpp", + "regex": "cpp", + "tuple": "cpp", + "valarray": "cpp" } } \ No newline at end of file diff --git a/README.md b/README.md index 850d344..7fde662 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,36 @@ git status git add . git commit -m "" git push -u origin master + + +--- +# `# include ` ## 高精度 1. python打表 2. 高精加和高精乘 +```cpp +void pplus(int *a, int *c) +{ + int jw = 0; + for (int i = 0; i < 1000; i++) + { + c[i] += a[i] + jw; + jw = c[i] / 10; + c[i] %= 10; + } +} +void pmultiply(int *a, int c) +{ + int jw = 0; + for (int i = 0; i < 1000; i++) + { + a[i] = a[i] * c + jw; + jw = a[i] / 10; + a[i] %= 10; + } +} +``` + ## 筛法 1. 打表 @@ -59,4 +86,104 @@ void prime(int b) } } } -``` \ No newline at end of file +``` +## 矩阵旋转 +1. 找规律 + +--- +## 重定向 +```cpp +freopen(file,"r",stdin); +freopen(file,"w",stdout); +``` +## 随机数的产生 +1. 初始化随机数种子 `srand(time(NULL))` +2. rand() + + +## STL初步 +1. sort(开始,结束,比较函数) +```cpp +struct Node +{ + int a, b; +}; +Node a[100]; +bool cmp(Node a, Node b) +{ + if (a.a != b.a) + return a.a > b.a; + return a.b > b.b; +} +sort(a, a + 100, cmp); +``` + +2. 不定长数组 vector +```cpp +#include +vector a; +a.size() +a.resize() +a.push_back() +a.pop_back() +a.clear() +``` +3. 集合 set + +```cpp +#define ALL(x) x.begin(), x.end() +#define INS(x) inserter(x, x.begin()) + +set a, b; +typedef set::iterator SI; +a.insert(1); +a.count(1); +for (SI i = a.begin(); i != a.end(); i++) + ; //遍历 +set_union(ALL(a), ALL(b), INS(a)); //并集,放入a中 +set_intersection(ALL(a), ALL(b), INS(a)); //交集,放入a中 + +``` +4. 映射 map 类似python中的字典 +```cpp +map dict; +dict['r']=1;//这里dict使用的是string的方法,而dict[]使用的是int的方法 +``` +5. 栈(后进先出),队列(先进先出) +```cpp +stack s; +s.top(); +s.push(1); +s.pop(); +s.empty(); +queue x; +x.front(); +x.pop(); +x.push(1); +x.empty(); +``` +6. 优先级队列 + +```cpp +struct cmp +{ + bool operator()(const int a, const int b) + { + return a > b; + //当a>b时,返回ture,也就是说越大优先级越小 + //出队列时,先弹出小的,小的在队列top + } +}; +priority_queue, cmp> a; +a.push(1); +a.pop(); +a.top(); +a.size(); +a.empty(); +``` + +### 注意点 +1. vector作为参数或返回值时,尽量使用传引用,会改变传入的参数。或者直接全局变量,传都不要传。 +2. 结构体静态变量: static 变量名 + +--- diff --git a/tempCodeRunnerFile.cpp b/tempCodeRunnerFile.cpp new file mode 100644 index 0000000..ca80b9b --- /dev/null +++ b/tempCodeRunnerFile.cpp @@ -0,0 +1,134 @@ +#include +using namespace std; + +int main() +{ + int n; + cin >> n; + char start[10][11], end[10][11]; + for (int i = 0; i < n; i++) + cin >> start[i]; + for (int i = 0; i < n; i++) + cin >> end[i]; + int flag = 1; + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + { + if (start[i][j] != end[j][n - 1 - i]) + { + flag = 0; + break; + } + } + if (flag == 1) + { + cout << 1; + return 0; + } + flag = 1; + for (int i = 0; i < n; i++) + for (int j = 0; j < n; j++) + { + if (start[i][j] != end[n - 1 - i][n - 1 - j]) + { + // cout<= 0; i--) - { - while (sum[n][i] == 0) - i--; - cout << sum[n][i]; - } + display(sum[n]); return 0; } \ No newline at end of file diff --git a/高精度/luogu_P1009.exe b/高精度/luogu_P1009.exe new file mode 100644 index 0000000..5a5def9 Binary files /dev/null and b/高精度/luogu_P1009.exe differ