07 2022 档案

摘要:错误点 测试点3、4过不了,代码写的太乱了,短时间找不出错误的地方,日后再改 代码 #include <iostream> #include <cstdio> #include <queue> #include <vector> #include <string> #include <algorit 阅读全文
posted @ 2022-07-21 14:16 qwasdasd 阅读(39) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点1、2:注意没有匹配成功的对的时候,结果不输出 如可尝试下列数据: 10 10 10 10 10 10 20 20 20 15 15 15 15 15 15 15 20 30 20 15 15 10 10 10 2 CYLL 01:01:06:01 on-line aaa 01:04: 阅读全文
posted @ 2022-07-20 20:15 qwasdasd 阅读(63) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <cmath> using namespace std; //将一个十进制的数转化成指定进制的数 //将转化后的数颠倒 //将颠倒后的数转化回十进制的数 //判断是 阅读全文
posted @ 2022-07-20 15:46 qwasdasd 阅读(19) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点2、4、5:如果有一个人开始服务时间在5点之前(不包括5点),结束服务时间在5点之后,那么需要服务这个人 测试点数据样例: 2 1 3 3 1 540 540 1 2 3 输出: 08:01 17:00 17:01 代码 #include <iostream> #include <cs 阅读全文
posted @ 2022-07-20 14:21 qwasdasd 阅读(187) 评论(0) 推荐(0) 编辑
摘要:关键 掌握深度优先搜索的代码实现(dfs),dfs可用于计算图中连通分量的个数 代码 #include <iostream> #include <cstdio> using namespace std; int g[1001][1001]; int visit[1001]; void dfs(int 阅读全文
posted @ 2022-07-20 10:49 qwasdasd 阅读(14) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <set> #include <vector> using namespace std; int r[1000000]={0}; char rc[1000000]; 阅读全文
posted @ 2022-07-19 14:57 qwasdasd 阅读(18) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; float a[10]; int main() { float w,t,l; for(int i=0;i<3;i++){ cin>>w>> 阅读全文
posted @ 2022-07-19 14:05 qwasdasd 阅读(22) 评论(0) 推荐(0) 编辑
摘要:易错点 这道题的测试点7的数据很大,因此如果硬要用顺序查找在找到之前会超时,只能用所谓的二分法才能通过这个点。 用二分查找的时候,需要注意long long也会溢出,需要设置一个特别的判断。 代码 #include <iostream> #include <cstdio> #include <iom 阅读全文
posted @ 2022-07-19 13:41 qwasdasd 阅读(70) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; float a[1001]={999999}; float b[1001]={999999}; float c[2002]={0};//放 阅读全文
posted @ 2022-07-18 22:36 qwasdasd 阅读(14) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int main() { int n; int a; int cnt=0; int tmp=0; cin>>n; for(int i=0;i<n;i++){ cin>>a; i 阅读全文
posted @ 2022-07-18 16:30 qwasdasd 阅读(18) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int a[10001];//记录每个数的值 int b[10001]={0};//记录子串的长度 int m[10001]={-1};//记录子串的最大长度 int l[10 阅读全文
posted @ 2022-07-18 16:13 qwasdasd 阅读(20) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int ttoi_diy(string a){ string t1,t2,t3; int cnt; t1=a.substr(0,2); t2 阅读全文
posted @ 2022-07-18 15:34 qwasdasd 阅读(27) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; string a[10]={"zero","one","two","three","four","five","six","seven"," 阅读全文
posted @ 2022-07-18 14:34 qwasdasd 阅读(14) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点1或其他测试点错了,可以尝试用下面这个数据测试: 3 2 02 1 03 01 1 02 代码 #include <iostream> #include <cstdio> using namespace std; int p[101]={-1};//记录每个点的父母结点的id int 阅读全文
posted @ 2022-07-18 14:16 qwasdasd 阅读(76) 评论(0) 推荐(0) 编辑
摘要:关键 这道题必须掌握Dijkstra算法的实现代码,在Dijkstra算法模板代码的基础上进行一定调整 易错点 测试点0或其他测试点错了,可以尝试用下面这个数据测试: 4 5 0 3 1 4 1 2 0 1 1 0 2 2 0 3 4 1 2 1 2 3 2 代码 #include <iostrea 阅读全文
posted @ 2022-07-18 12:49 qwasdasd 阅读(50) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; float c[1001]; int main() { for(int i=0;i<1001;i++){ c[i]=0; } int k1 阅读全文
posted @ 2022-07-17 16:41 qwasdasd 阅读(13) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { int a,b; int c; string s; int f=0; cin>>a>>b; c=a+b; s=to 阅读全文
posted @ 2022-07-17 15:53 qwasdasd 阅读(13) 评论(0) 推荐(0) 编辑
摘要:思路 把谁是狼人、谁撒谎的所有可能性全部遍历一遍, 代码 #include <iostream> #include <cstdio> #include <cmath> using namespace std; int a[101]; int b[101]; int c[101]; int main( 阅读全文
posted @ 2022-07-17 15:22 qwasdasd 阅读(148) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点1、4、5:如果这些点错了,可以尝试测试一下下面这组数据: 00100 9 10 00100 -18 12309 12309 -7 33218 33218 -3 00000 00000 0 99999 99999 -5 68237 68237 -6 23333 23333 -10 27 阅读全文
posted @ 2022-07-17 14:12 qwasdasd 阅读(71) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点6:输入给出一个不超过1000位的正整数,需要用数组存放这个数 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; bool is_Palindromic(string a){ 阅读全文
posted @ 2022-07-17 10:34 qwasdasd 阅读(34) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点2:插入排序的判断,思路是否正确,可检验测试点:3 1 3 2 1 3 2,如果输出:插入排序,1 2 3,即正确 测试点5、6:归并排序中,若归并的每组数的数量为n,若最后一组数的数量不足n,此时最后一组数也要记得进行排序。如: 7 3 1 2 8 7 5 9 1 3 2 8 5 7 阅读全文
posted @ 2022-07-17 09:33 qwasdasd 阅读(212) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点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 阅读(92) 评论(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 阅读(16) 评论(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 阅读(27) 评论(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 阅读(37) 评论(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 阅读(17) 评论(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 阅读(25) 评论(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 阅读(46) 评论(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 阅读(20) 评论(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 阅读(251) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点1、2:注意输入字符串末尾连续多个非字母字符的情况,如:“DASJD'ASDDA;SAD.;;” 测试点3:空格也算字符,因此不能用cin,要用getline() 测试点4:字母结尾的情况,如“SADS.ASDDA" 代码 #include <iostream> #include <c 阅读全文
posted @ 2022-07-16 09:38 qwasdasd 阅读(180) 评论(1) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { string s; map<char,int> mp; mp['S']=0; mp[ 阅读全文
posted @ 2022-07-15 23:27 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int main() { int n,m; int w; int maxw; int maxmaxw=-11; cin>>n>>m; for(int i=0;i<n;i++){ 阅读全文
posted @ 2022-07-15 23:18 qwasdasd 阅读(30) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; char a[1000]; int main() { int n; a[0]='2'; a[1]='0'; a[2]='1'; a[3]=' 阅读全文
posted @ 2022-07-15 23:11 qwasdasd 阅读(28) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int a[100000]; string nxt[100000]; string p1[100000]; string p2[100000 阅读全文
posted @ 2022-07-15 22:40 qwasdasd 阅读(47) 评论(0) 推荐(0) 编辑
摘要:如果输入是可以遍历的,先找一份ac代码,然后将它和自己的代码的输出都改为拼接字符串,将两份代码放到一个程序里,比较两个代码的输出字符串,就有机会找出让自己代码无法ac的测试点。 阅读全文
posted @ 2022-07-15 17:32 qwasdasd 阅读(20) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点2,需要排序,先按n排,再按A排 如果用了map/vector,测试点0、1、3,每次循环完需要clear() 代码 #include <iostream> #include <cstdio> #include <string> #include <utility> #include 阅读全文
posted @ 2022-07-15 17:28 qwasdasd 阅读(155) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点4考察:1和1算不算一对缘分数 由于题目中提到“其中 a 和它的小弟 a−1 的立方差正好是另一个整数 c 的平方”,“另一个整数”指明隐含条件:a != c 代码 #include <iostream> #include <cstdio> #include <cmath> using 阅读全文
posted @ 2022-07-15 10:50 qwasdasd 阅读(112) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { int n; string id; int price; int sales; int maxa=-1; int 阅读全文
posted @ 2022-07-15 10:17 qwasdasd 阅读(16) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <iomanip> using namespace std; int main() { string a; int d; string b; cin>>a>>d; 阅读全文
posted @ 2022-07-15 09:50 qwasdasd 阅读(35) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <map> #include <string> using namespace std; int main() { int n; string index; map<string,int> mp; i 阅读全文
posted @ 2022-07-15 09:35 qwasdasd 阅读(62) 评论(0) 推荐(0) 编辑
摘要:易错点 if((is_nature(n)==1&&is_nature(n+6)==1)||(is_nature(n)==1&&is_nature(n-6)==1)){ 此处判断不能只考虑(n+6)为素数的情况,而忽略了(n-6)为素数的情况 代码 #include <iostream> #inclu 阅读全文
posted @ 2022-07-14 23:51 qwasdasd 阅读(137) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int tmpb[101]; int main() { int n; int a; int mina=1001; int b; int maxb=-1; cin>>n; for 阅读全文
posted @ 2022-07-14 22:17 qwasdasd 阅读(28) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int a[100][100]; int main() { int n,k,x; cin>>n>>k>>x; for(int i=0;i<n;i++){ for(int j=0 阅读全文
posted @ 2022-07-14 21:13 qwasdasd 阅读(29) 评论(0) 推荐(0) 编辑
摘要:思路 当一个数的所有因子的和(不包括自身)大于或等于这个数,那么这个数就是大美数 代码 #include <iostream> #include <cstdio> using namespace std; bool is_b(int a){ int cnt=0; for(int i=1;i<a;i+ 阅读全文
posted @ 2022-07-14 19:58 qwasdasd 阅读(152) 评论(0) 推荐(0) 编辑
摘要:注意点 一开始解这道题只过了两个点,但翻了各种题解,感觉思路没有任何问题。最后终于找到一篇博客提供测试点的数据,发现还是漏了在循环后对数组的初始化。 代码 #include <iostream> #include <cstdio> #include <string> #include <utilit 阅读全文
posted @ 2022-07-14 19:30 qwasdasd 阅读(27) 评论(0) 推荐(0) 编辑
摘要:错误点 2是素数。。。这一处考虑错了 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; bool is_nature(long long a){ if(a==1||a==0){ return 阅读全文
posted @ 2022-07-14 13:55 qwasdasd 阅读(12) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; int main() { string s1,s2; map<char,int> mp; getline(ci 阅读全文
posted @ 2022-07-14 11:35 qwasdasd 阅读(21) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; long long a[1001]; int main() { for(int i=0;i<1000;i++){ a[i]=0; } long long n,m; long l 阅读全文
posted @ 2022-07-14 11:26 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { int m; int a; int tmp; int tmp3; int tmp4; int tmp5; int 阅读全文
posted @ 2022-07-14 10:46 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; string a[100001]; string b[1001]; int main() { int n,m; int k; string 阅读全文
posted @ 2022-07-14 10:13 qwasdasd 阅读(16) 评论(0) 推荐(0) 编辑
摘要:注意点 浮点数不能用“==”判断是否相等,需要用abs(x1-x2)<=0.00001的方式 代码 #include <iostream> #include <cstdio> #include <string> #include <cmath> using namespace std; const 阅读全文
posted @ 2022-07-13 18:40 qwasdasd 阅读(14) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int a[20000]; int main() { int n; int cnt=0; cin>>n; for(int i=0;i<200 阅读全文
posted @ 2022-07-13 14:35 qwasdasd 阅读(27) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <map> #include <set> #include <utility> #include <vector> #include <algorithm> usi 阅读全文
posted @ 2022-07-13 14:29 qwasdasd 阅读(30) 评论(0) 推荐(0) 编辑
摘要:注意点 bool cmp_diy(const pair3& a,const pair3& b){//const xxx & x 作用是引用某个变量,只读它的内容,但不能修改这个引用的变量 代码 #include <iostream> #include <cstdio> #include <strin 阅读全文
posted @ 2022-07-13 14:24 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点4超时 解决方案 tmps=tmps+tmpc+to_string(tmp); 改成 tmps+=tmpc+to_string(tmp); 原因 a+=b比a=a+b快很多! 因此+=的形式不仅仅是代码书写习惯的问题,关系到代码运行速度,可以尽量写成+=的形式。 代码 #include 阅读全文
posted @ 2022-07-13 13:09 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <cmath> using namespace std; int r[10001]; int main() { int n; int a; for(int i=0;i<10001;i++){ r[i] 阅读全文
posted @ 2022-07-13 12:24 qwasdasd 阅读(9) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <cmath> #include <string> using namespace std; int main() { int n; string id; float x,y; float p; fl 阅读全文
posted @ 2022-07-13 12:18 qwasdasd 阅读(21) 评论(0) 推荐(0) 编辑
摘要:易错点 输入格式中提到:“每行给出一个用户设置的密码,为不超过 80 个字符的非空字符串”,因此可能包含空格。测试点2即包含空格,如果用“cin>>a",测试点2会过不去,需要用cin.getline() 代码 #include <iostream> #include <cstdio> #inclu 阅读全文
posted @ 2022-07-13 12:10 qwasdasd 阅读(26) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点3:如果总评用float,测试点3会报错,换成int后能ac,原因不解 注意点 utility中的pair放到vector后用sort()可以对pair中的两个值进行自定义排序 代码 #include <iostream> #include <cstdio> #include <str 阅读全文
posted @ 2022-07-13 11:23 qwasdasd 阅读(60) 评论(0) 推荐(0) 编辑
摘要:注意点 string里有个to_string()可以实现int转string 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; bool is_Palindromic(string a){ 阅读全文
posted @ 2022-07-12 23:33 qwasdasd 阅读(20) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { char ch; string s; char tmpc; int tmp=0; cin>>ch; getchar 阅读全文
posted @ 2022-07-12 22:25 qwasdasd 阅读(37) 评论(0) 推荐(0) 编辑
摘要:易错点 很多关键细节在题干背景里,而不单单是输出格式里,很容易忽略 setprecision有误差,.5会舍去而不是进位 代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; int main 阅读全文
posted @ 2022-07-12 20:27 qwasdasd 阅读(18) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { string s; int n; cin>>n; getchar(); for(int i=0;i<n;i++){ 阅读全文
posted @ 2022-07-12 19:54 qwasdasd 阅读(45) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; long a[100002]; string nxt[100002]; int main() { string faddr; string h,p1,p2; string f, 阅读全文
posted @ 2022-07-12 18:59 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:易错点 最高位的进位不要忽略 需要考虑两个0相加的情况程序不出错 代码 #include <iostream> #include <cstdio> #include <string> #include <stack> using namespace std; int main() { string 阅读全文
posted @ 2022-07-12 14:56 qwasdasd 阅读(37) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <iomanip> using namespace std; float point[101]; int num[101]; int rnum[101]; floa 阅读全文
posted @ 2022-07-12 13:36 qwasdasd 阅读(24) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <set> #include <string> using namespace std; int main() { int n,m; string index; string name; set<st 阅读全文
posted @ 2022-07-12 11:56 qwasdasd 阅读(24) 评论(0) 推荐(0) 编辑
摘要:#include #include using namespace std; int main() { int T,k; int n1,b,t,n2; cin>>T>>k; for(int i=0;i<k;i++){ cin>>n1>>b>>t>>n2; if(t>T){ cout<<"Not en 阅读全文
posted @ 2022-07-12 11:21 qwasdasd 阅读(9) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <set> using namespace std; int main() { int n; int a; int tmp; int tmp2; multiset<int> st; cin>>n; f 阅读全文
posted @ 2022-07-12 10:49 qwasdasd 阅读(42) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <map> using namespace std; string name[1001]; int main() { int m,n,s; int tmp=-999 阅读全文
posted @ 2022-07-12 10:15 qwasdasd 阅读(38) 评论(0) 推荐(0) 编辑
摘要:易错点 题干背景中“独一无二颜色的那个像素点”,指出了颜色需要唯一的条件,即颜色值有重复的点并不算是符合要求的点,但是表达并不明确,和输入格式要求“如果这样的点不唯一,则输出 Not Unique”这句话容易混淆,输入格式要求这句话指的是如果有多个符合要求的点,则输出Not Unique。 代码 # 阅读全文
posted @ 2022-07-11 23:57 qwasdasd 阅读(59) 评论(0) 推荐(0) 编辑
摘要:易错点 审题!题干中指出输入不包含空格,但没有对输出做出更多说明,因此不能想当然认为输出不包含空格,必须考虑输出包含空格的情况! 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int m 阅读全文
posted @ 2022-07-11 22:19 qwasdasd 阅读(29) 评论(0) 推荐(0) 编辑
摘要:易错点 这道题用cin会超时,scanf比cin快! 代码 #include <iostream> #include <cstdio> #include <set> #include <string> using namespace std; string x[100000]; int main() 阅读全文
posted @ 2022-07-11 21:44 qwasdasd 阅读(23) 评论(0) 推荐(0) 编辑
摘要:易错点 如果变量是整数且需要输出时,要注意如“00001”这样的数前面的0是不能舍去的 代码 #include <iostream> #include <cstdio> #include <set> #include <string> using namespace std; string x[10 阅读全文
posted @ 2022-07-11 21:08 qwasdasd 阅读(25) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> #include <set> using namespace std; int main() { int n; string a; int tmp; set<int> st; cin 阅读全文
posted @ 2022-07-11 20:25 qwasdasd 阅读(12) 评论(0) 推荐(0) 编辑
摘要:注意点 开方用到cmath 代码 #include <iostream> #include <cstdio> #include <cmath> #include <iomanip> using namespace std; int main() { int n; int a,b; float tmp 阅读全文
posted @ 2022-07-11 19:37 qwasdasd 阅读(36) 评论(0) 推荐(0) 编辑
摘要:易错点 测试点1:审题务必仔细!题干中没有说明N1/M1 和 N2/M2的大小,容易认为N1/M1小于 N2/M2,但可能有N1/M1大于 N2/M2 测试点2:注意遍历的方法,以免运行超时 测试点4:查找分母和分子的公因数的时候,须考虑分母可能是分子的倍数 关键 找可能的分子 判断两个数是否互质 阅读全文
posted @ 2022-07-11 19:25 qwasdasd 阅读(137) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; long a[100002]; bool cmp1(long a,long b){ return a>b; } int main() 阅读全文
posted @ 2022-07-11 15:45 qwasdasd 阅读(16) 评论(0) 推荐(0) 编辑
摘要:易错点 每天的骑车距离最大为1的情况下,爱丁顿数 E为0 代码 #include <iostream> #include <cstdio> #include <algorithm> using namespace std; long a[100002]; bool cmp1(long a,long 阅读全文
posted @ 2022-07-11 15:34 qwasdasd 阅读(46) 评论(0) 推荐(0) 编辑
摘要:注意点 判断素数问题 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int ran[10001]; int natu[10001]; bool nat(int a){ if(a%2==0 阅读全文
posted @ 2022-07-11 13:30 qwasdasd 阅读(25) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> #include <string> using namespace std; string s[102]; int point[102]; int count[102]; int rcount[102]; int st 阅读全文
posted @ 2022-07-11 12:59 qwasdasd 阅读(20) 评论(0) 推荐(0) 编辑
摘要:关键 二进制的算法 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; int main() { string s; int cnt=0; int zcnt=0,ocnt=0; getline 阅读全文
posted @ 2022-07-11 12:20 qwasdasd 阅读(22) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int main() { int n; int a; int cnt=0; cin>>n; for(int i=0;i<n;i++){ cin>>a; cnt+=a*11*(n 阅读全文
posted @ 2022-07-11 12:00 qwasdasd 阅读(25) 评论(0) 推荐(0) 编辑
摘要:关键 双端队列的使用 数值和字符串的相互映射(有重复值) 代码 #include <iostream> #include <cstdio> #include <string> #include <set> #include <deque> #include <algorithm> using nam 阅读全文
posted @ 2022-07-11 11:50 qwasdasd 阅读(19) 评论(0) 推荐(0) 编辑
摘要:易错点 变量名要看清楚 操作数组要谨慎 代码 #include <iostream> #include <cstdio> #include <string> #include <iomanip> using namespace std; int main(){ int n; string s; ci 阅读全文
posted @ 2022-07-10 18:18 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:注意点 c++里的百分号输出似乎只能*100后手动加% 代码 #include <iostream> #include <cstdio> #include <iomanip> using namespace std; int main(){ int n; float e; int d; int k; 阅读全文
posted @ 2022-07-10 15:40 qwasdasd 阅读(13) 评论(0) 推荐(0) 编辑
摘要:错误点 须考虑题干中提到“若用户选择的序号不存在”,可能会大于上限,也可能会小于等于0的情况 注意点 在一串字符中选取特定字符作为输入 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; st 阅读全文
posted @ 2022-07-10 14:49 qwasdasd 阅读(38) 评论(0) 推荐(0) 编辑
摘要:错误点 (-0.005,0)上的数精确到小数点后两位时应是0而不是-0 注意点 cmath中的sin()和cos() 代码 #include <iostream> #include <cstdio> #include <cmath> #include <iomanip> using namespac 阅读全文
posted @ 2022-07-10 11:39 qwasdasd 阅读(26) 评论(0) 推荐(0) 编辑
摘要:问题分解 数组倒序排列 指定正整数,求其两个最接近的因子m、n 顺时针螺旋矩阵打印 注意点 二维数组 代码 #include <iostream> #include <cstdio> #include <set> #include <vector> using namespace std; int 阅读全文
posted @ 2022-07-10 10:40 qwasdasd 阅读(27) 评论(0) 推荐(0) 编辑
摘要:问题 cnt=cnt+a[i]*(i+1)*(n-i); 此处容易溢出,因此必须用long double 注意点 cout的格式化输出,iomanip cout<<fixed<<setprecision(2)<<cnt; 代码 #include <iostream> #include <cstdio 阅读全文
posted @ 2022-07-09 18:25 qwasdasd 阅读(32) 评论(0) 推荐(0) 编辑
摘要:注意点 高位的0要舍去 所有位都是0的情况输出一个0 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; char a[101]; char b[101]; int main(){ strin 阅读全文
posted @ 2022-07-09 17:32 qwasdasd 阅读(27) 评论(0) 推荐(0) 编辑
摘要:注意点 输入为数字掺杂字符时,用scanf会比较方便 代码 #include <iostream> #include <cstdio> using namespace std; int a[1002]; int main(){ for(int i=0;i<1002;i++){ a[i]=0; } i 阅读全文
posted @ 2022-07-09 14:18 qwasdasd 阅读(20) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream> #include <cstdio> using namespace std; int main(){ int n; int a,b,c,d; int x=0,y=0; cin>>n; for(int i=0;i<n;i++){ cin>>a>>b>>c> 阅读全文
posted @ 2022-07-09 14:10 qwasdasd 阅读(19) 评论(0) 推荐(0) 编辑
摘要:问题 测试点2格式错误,测试点2是0个可能的主元的情况,这里需要额外再加一个换行才能ac(原因不解) 思路 设置三个数组A、B、C,第一个数组A存放原本的排列,第二个数组B里的每个位置对应数组A相应位置向左的所有数的最大值,第三个数组C里的每个位置对应数组A相应位置向右的所有数的最小值。 再依次比较 阅读全文
posted @ 2022-07-09 13:52 qwasdasd 阅读(99) 评论(0) 推荐(0) 编辑
摘要:问题 测试点2、3、4通不过,但是已经检验了多种特殊测试点,未发现问题 注意点 substr()的使用 map的使用 cin.sync()清空输入缓冲区 cin.getline()读取带空格的输入 字符串输入中带空格的情况 火星文中,如130的表示,只需要表示出高位数字,低位的0不需要显示 代码 # 阅读全文
posted @ 2022-07-09 10:47 qwasdasd 阅读(85) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream>#include <cstdio>#include <map>using namespace std;​​int main(){ char c; map<char,int> mp; mp['P']=0; mp['A']=0; mp['T']=0; mp[' 阅读全文
posted @ 2022-07-08 22:55 qwasdasd 阅读(15) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream>#include <cstdio>#include <string>#include <map>​using namespace std;​​int main(){ string a; int b,c; int m,n; int d; map<int,st 阅读全文
posted @ 2022-07-08 22:05 qwasdasd 阅读(121) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream>#include <cstdio>#include <map>#include <string>using namespace std;​​int main(){​ map<char,int> mp; map<char,int>::iterator max 阅读全文
posted @ 2022-07-08 20:18 qwasdasd 阅读(22) 评论(0) 推荐(0) 编辑
摘要:关键 PAT的个数就是A左边P的个数乘以右边T的个数 时间复杂度必须为o(n) 思路 从头开始向后遍历字符串。 如果是’P',A左边的p的count++; 如果是‘A',cnt+=A左边的p的count*(t的count-A左边的t的count); 如果是’T‘,A左边的t的count++ 代码 # 阅读全文
posted @ 2022-07-08 19:20 qwasdasd 阅读(58) 评论(0) 推荐(0) 编辑
摘要:代码 #include <iostream>#include <cstdio>#include <set>#include <string>using namespace std;​​int main(){ string s,s2; int l1,l2; int cnt=0; multiset<ch 阅读全文
posted @ 2022-07-08 17:32 qwasdasd 阅读(64) 评论(0) 推荐(0) 编辑
摘要:关掉360 阅读全文
posted @ 2022-07-08 16:08 qwasdasd 阅读(531) 评论(0) 推荐(0) 编辑
摘要:水题 代码 #include <iostream>#include <cstdio>using namespace std;​int a[102];int main(){ for(int i=0;i<101;i++){ a[i]=0; } long n,k; int m,j; cin>>n; for 阅读全文
posted @ 2022-07-08 16:07 qwasdasd 阅读(153) 评论(0) 推荐(0) 编辑
摘要:注意点 输入为几个数字夹杂着字符时,要从中取出几个数字作为真正的输入 int、long、long long的取值范围与选择 问题 scanf和cout不能混用 long long情况下,在scanf里,不是%d,而是%lld 代码 #include <iostream>#include <cstdi 阅读全文
posted @ 2022-07-08 15:55 qwasdasd 阅读(17) 评论(0) 推荐(0) 编辑
摘要:代码 #include <cstdio>#include <iostream>using namespace std;​int main(){ int n; int m; char c; cin>>n>>c; for(int i=0;i<n;i++){ cout<<c; } cout<<endl; 阅读全文
posted @ 2022-07-08 14:38 qwasdasd 阅读(119) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示