摘要:
水题。//输入为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; 阅读全文
摘要:
使用了STL中的stack,常用操作的时间复杂度大都是O(1)。 总体比较水。考察进制转换的除基取余法。 #include"iostream" #include<stack> using namespace std; int main() { int a,b,d,sum; cin>>a>>b>>d; 阅读全文
摘要:
水题。 #include"iostream" using namespace std; int hashtable[10] = {0}; int main() { string str; cin>>str; for(int i = 0; i < str.length(); ++i) hashtabl 阅读全文
摘要:
简单贪心算法。 把月饼按单价递减的顺序排列。 需求一定时,每次售出单价最高的月饼存量. #include"iostream" #include<algorithm> using namespace std; struct Moocake { double store,sale,price; } m[ 阅读全文
摘要:
注意:位数不够四位,就高位补0; 新学一个string函数。str.insert(pos,N,字符)a56爆大奖在线娱乐在pos位置,插入N个字符。 #include"iostream" #include<algorithm> using namespace std; bool cmp(char a,char b) 阅读全文
摘要:
岂可修,居然做错一次,水题。 #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}; 阅读全文
摘要:
大整数与整数的除法运算,求商q,余数r。 思路就是小学的除法运算。 默认初始余数 r = 0。 第一步,r = r*10+bign[i]-'0'; 第二步求商,q = r/d; 第三步求余数,r = r%d; #include"iostream" using namespace std; int m 阅读全文
摘要:
水题。 #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 < 阅读全文