摘要: while( scanf ("%d",&x ) ==1) 这里scanf返回的是成功输入的变量个数,当输入结束的时候,scanf函数无法再次读取x,将返回0 比较大的数组应该尽量声明在main函数外,否则程序可能无法运行 关于c语言的数组:如果要从数组a复制k个元素到b,可以这样做:memcpy(b 阅读全文
posted @ 2019-10-29 18:40 晴屿 阅读(135) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/796/ #include<bits/stdc++.h> using namespace std; // A/b 商是c 余数是r vector<int> div(vector<int> &A, int b,int &r) 阅读全文
posted @ 2019-10-29 10:25 晴屿 阅读(187) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/795/ #include<bits/stdc++.h> using namespace std; //A*b 一个高精度的数乘一个低精度的数 vector<int> mul(vector<int> &A, int b) 阅读全文
posted @ 2019-10-29 10:24 晴屿 阅读(198) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/794/ #include<bits/stdc++.h> using namespace std; //判断是否有a>=b 如果是 返回true 反之 返回false bool cmp(vector<int>&A,vect 阅读全文
posted @ 2019-10-29 10:22 晴屿 阅读(145) 评论(0) 推荐(0)
摘要: https://www.acwing.com/problem/content/793/ #include<bits/stdc++.h> using namespace std; vector<int> add(vector<int> &A, vector<int> &B) { vector<int> 阅读全文
posted @ 2019-10-29 10:21 晴屿 阅读(154) 评论(0) 推荐(0)