个人的易错点
小耗子001
得到的和得不到的都是收获
展开
-
字符串处理的注意点
1.gets,是遇到\n 就结束,不代表它不碰一下\n,如果不把上一行的转换字符吸收掉,很可能下一行,就莫名其妙的少一行字符串了。原创 2018-04-23 20:08:11 · 357 阅读 · 0 评论 -
patB1043 输出PATest
注意:字符串长度的确定要放在循环体外。这样会减少运行的时间。#include <iostream>#include <cstdio>#include <cstring> using namespace std;char strT[6]={'P','A','T','e','s','t'};int hashT[6]={0};int main(int argc, ch...原创 2018-05-02 14:11:19 · 196 阅读 · 0 评论 -
patA1041 Be Unique
要按照输入的次序来,我们要对有序数字进行记录。#include <iostream>#include <cstdio>using namespace std;int hashT[10001]={0};int record[100001];int main(int argc, char** argv) { int n; scanf("%d",&n); for(int ...原创 2018-05-02 14:50:43 · 114 阅读 · 0 评论 -
patA1050 String Subtration
#include <iostream>#include <cstdio>#include <cstring>using namespace std;char str1[10001];char str2[10001];int hashT[128]={0}; //record the number;int main(int argc, cha...原创 2018-05-02 15:06:15 · 127 阅读 · 0 评论 -
patA1038 Recover the Smallest Number
using namespace std;const int maxn=10001;string str[maxn];//bool cmp(string a,string b){// return a<b;//}int main(int argc, char** argv) { int n; cin>>n; for(int i=0;i<n;i++) cin>>st...原创 2018-05-09 21:50:01 · 150 阅读 · 0 评论 -
patA1085 完美数列(25)
注意点:int*int 最大值可能达到10^18暴力解决的时间复杂度肯定超时。#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int binarySearch(int i,int n,lo...原创 2018-05-11 20:45:43 · 173 阅读 · 0 评论 -
patA1085 完美数列 upper_bound()
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,p; scanf("%d%d",&n,&p)...原创 2018-05-11 21:20:26 · 158 阅读 · 0 评论 -
patB1039 到底买不买
#include <iostream>#include <cstdio>#include <cstring> using namespace std;int hashT[128]={0};int hashb[128]={0};int main(int argc, char** argv) { char str1[20],str2[20]; gets(str1);...原创 2018-04-27 21:22:23 · 129 阅读 · 0 评论