摘要: 易错点 测试点2、3:要用long long,同时这两个点卡求gcd的运行时间,因此需要熟练掌握求gcd的辗转相除法的代码 int gcd(int a,int b){//求最大公约数,辗转相除法 if(a<0){ a=-a; } if(b<0){ b=-b; } if(b==0){ return a 阅读全文
posted @ 2022-07-16 19:07 qwasdasd 阅读(100) 评论(0) 推荐(0)
摘要: 易错点 注意范围,int会溢出的话要用long long 代码 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; long long a[100001]; int main() { int 阅读全文
posted @ 2022-07-16 16:54 qwasdasd 阅读(18) 评论(0) 推荐(0)
摘要: 注意点 unordered_set 代码 #include <iostream> #include <cstdio> #include <string> #include <queue> #include <map> using namespace std; string to_c(string a 阅读全文
posted @ 2022-07-16 16:00 qwasdasd 阅读(30) 评论(0) 推荐(0)
摘要: 易错点 测试点3:k=1的情况 测试点6:有无效结点,此时结点总个数不等于要反转的链表的结点总个数 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int a[100001]; strin 阅读全文
posted @ 2022-07-16 15:00 qwasdasd 阅读(43) 评论(0) 推荐(0)
摘要: 易错点 注意题目要求:运行时间必须按照 hh:mm:ss(即2位的 时:分:秒)格式输出 代码 #include <iostream> #include <cstdio> using namespace std; int main() { int t; float c1,c2; cin>>c1>>c 阅读全文
posted @ 2022-07-16 12:58 qwasdasd 阅读(21) 评论(0) 推荐(0)
摘要: 易错点 测试点8:A2的和为零但不为空的情况 代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; int a[1002]; int main() { int n; int cnt1=0; i 阅读全文
posted @ 2022-07-16 12:38 qwasdasd 阅读(28) 评论(0) 推荐(0)
摘要: 易错点 测试点2、4:当输入只有指数为0的数,这时候输出要特别设置为“0 0” 代码 #include <iostream> #include <cstdio> using namespace std; int main() { int a,b; int tmp=0; while(cin>>a>>b 阅读全文
posted @ 2022-07-16 11:43 qwasdasd 阅读(51) 评论(0) 推荐(0)
摘要: #include #include #include using namespace std; int a[10000]; int main() { for(int i=0;i<10000;i++){ a[i]=0; } int k; int n; int tmp; multiset st; cin 阅读全文
posted @ 2022-07-16 11:09 qwasdasd 阅读(26) 评论(0) 推荐(0)
摘要: 易错点 测试点1、4:结点数量n和区块结点数k满足(n-1)%k==0的情况 测试点2:k为1的情况 如输入为:“00100 2 1 00100 1 12309 12309 2 -1” 代码 #include <iostream> #include <cstdio> #include <string 阅读全文
posted @ 2022-07-16 10:53 qwasdasd 阅读(263) 评论(0) 推荐(0)
摘要: 易错点 测试点1、2:注意输入字符串末尾连续多个非字母字符的情况,如:“DASJD'ASDDA;SAD.;;” 测试点3:空格也算字符,因此不能用cin,要用getline() 测试点4:字母结尾的情况,如“SADS.ASDDA" 代码 #include <iostream> #include <c 阅读全文
posted @ 2022-07-16 09:38 qwasdasd 阅读(224) 评论(1) 推荐(0)