摘要: 第一种方法。 直接模拟插入排序和非递归的归并排序。。。 #include<iostream> #include<algorithm> using namespace std; int n; int a[111] = {0},b[111]= {0},temp[111] = {0}; bool flag 阅读全文
posted @ 2020-02-18 16:43 tangq123 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 这是一种套路题,需要记住大体流程,然后反复练习。 注意点: 因为题目给出的整数可能超过int范围,所以整数都必须用long long型存放,不然最后两个测试点过不去。 #include<iostream> #include<algorithm> using namespace std; typede 阅读全文
posted @ 2020-02-18 16:36 tangq123 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 注意点: 一,下划线 _(代表空格),接收输入是真的空格,所以要用getline接收一行输入。 二,判断大写字母能否输出,必须同时上档键+和小写字母的键都未坏。 #include<iostream> #include<cctype> using namespace std; string str1, 阅读全文
posted @ 2020-02-18 16:33 tangq123 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 水题。 #include<iostream> using namespace std; int a[100010]= {0}; int main() { int n,num,score,max = -1,pos = -1; cin>>n; for(int i = 0; i < n; ++i) { c 阅读全文
posted @ 2020-02-18 16:29 tangq123 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 注意点: 一,加权求和表示,每一位乘以该位的权值最后求和,只对前17位加权求和。 新学一招,整型到字符的hash。 string hashtable = "10X98765432"; #include<iostream> #include<cctype> using namespace std; s 阅读全文
posted @ 2020-02-18 16:28 tangq123 阅读(187) 评论(0) 推荐(0) 编辑
摘要: two pointers通向扫描法。 #include<iostream> #include<algorithm> using namespace std; typedef long long LL; LL a[100010] = {0}; int main() { int n,p,max = -1 阅读全文
posted @ 2020-02-18 12:06 tangq123 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 水题。与B1093 字符串A+B 类似。 #include<iostream> #include<cctype> using namespace std; bool hashtable[300] = {false}; int main() { string str1,str2; cin>>str1> 阅读全文
posted @ 2020-02-18 12:05 tangq123 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 水题。注意点,可能出现合理生日的总数为0的情况,要特判输出。 #include<iostream> using namespace std; int main() { int n,cnt = 0; string name,birthday; string youngest_name,youngest 阅读全文
posted @ 2020-02-18 12:02 tangq123 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 水题。在计算层数的时候卡了十几分钟,我好菜。 #include<iostream> using namespace std; int main() { int N; char c; cin>>N>>c; int layer = 1,sum = 1;//sum表示层数layer对应的总字符数 whil 阅读全文
posted @ 2020-02-18 11:59 tangq123 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 水题。 #include<iostream> #include<cmath> using namespace std; int main() { int c1,c2; cin>>c1>>c2; int t = round((c2-c1)/100.0);//不足 1 秒的时间四舍五入到秒 int h 阅读全文
posted @ 2020-02-18 11:57 tangq123 阅读(97) 评论(0) 推荐(0) 编辑