摘要: 水题。//输入为2 0 0 0 0 0 0 0 0 0会输出 00,但是还是对的。奇怪 #include<iostream> using namespace std; int a[10] = {0}; int main() { int flag = 0; for(int i = 0; i < 10; 阅读全文
posted @ 2020-02-16 16:49 tangq123 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 使用了STL中的stack,常用操作的时间复杂度大都是O(1)。 总体比较水。考察进制转换的除基取余法。 #include"iostream" #include<stack> using namespace std; int main() { int a,b,d,sum; cin>>a>>b>>d; 阅读全文
posted @ 2020-02-16 16:31 tangq123 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 水题。 #include"iostream" using namespace std; int hashtable[10] = {0}; int main() { string str; cin>>str; for(int i = 0; i < str.length(); ++i) hashtabl 阅读全文
posted @ 2020-02-16 16:09 tangq123 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 简单贪心算法。 把月饼按单价递减的顺序排列。 需求一定时,每次售出单价最高的月饼存量. #include"iostream" #include<algorithm> using namespace std; struct Moocake { double store,sale,price; } m[ 阅读全文
posted @ 2020-02-16 12:53 tangq123 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 注意:位数不够四位,就高位补0; 新学一个string函数。str.insert(pos,N,字符)a56爆大奖在线娱乐在pos位置,插入N个字符。 #include"iostream" #include<algorithm> using namespace std; bool cmp(char a,char b) 阅读全文
posted @ 2020-02-16 12:50 tangq123 阅读(101) 评论(0) 推荐(0) 编辑
摘要: 岂可修,居然做错一次,水题。 #include"iostream" using namespace std; int main() { int N; cin>>N; int A = 0, B = 0, C = 0;//A,B,C a56爆大奖在线娱乐甲的胜,平,负 int a[3]= {0},b[3]= {0}; 阅读全文
posted @ 2020-02-16 12:47 tangq123 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 大整数与整数的除法运算,求商q,余数r。 思路就是小学的除法运算。 默认初始余数 r = 0。 第一步,r = r*10+bign[i]-'0'; 第二步求商,q = r/d; 第三步求余数,r = r%d; #include"iostream" using namespace std; int m 阅读全文
posted @ 2020-02-16 12:46 tangq123 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 水题。 #include"iostream" using namespace std; int main() { string str1,str2; char da,db; int pa = 0,pb = 0; cin>>str1>>da>>str2>>db; for(int i = 0; i < 阅读全文
posted @ 2020-02-16 12:32 tangq123 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 没啥好说的,按题意对数据排序输出即可。 STL:vector,string.用cin/cout可能会超时,改成scanf和printf即可。 #include"iostream" #include"algorithm" #include"vector" using namespace std; st 阅读全文
posted @ 2020-02-15 21:38 tangq123 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题意有点不明不白。 注意点:字符间的比较是在同一下标进行的(不然测试点1,4过不了)。 #include"iostream" #include"cctype" using namespace std; string hashtable1[7] = {"MON ","TUE ","WED ","THU 阅读全文
posted @ 2020-02-15 21:34 tangq123 阅读(180) 评论(0) 推荐(0) 编辑