标签:乙级 turn namespace return += ace span space include
1 #include <iostream> 2 #include <cmath> 3 using namespace std; 4 5 int main() { 6 int a = 0, da = 0; 7 int b = 0, db = 0; 8 cin >> a >> da >> b >> db; 9 int cnta = 0, cntb = 0; 10 int chu = a, yu = 0; 11 while (chu >= 10) { 12 yu = chu % 10; 13 chu /= 10; 14 if (yu == da) 15 cnta++; 16 } 17 if (chu == da) cnta++; 18 chu = b, yu = 0; 19 while (chu >= 10) { 20 yu = chu % 10; 21 chu /= 10; 22 if (yu == db) 23 cntb++; 24 } 25 if (chu == db) cntb++; 26 int pa = 0, pb = 0; 27 while (cnta--) { 28 pa += pow(10, cnta) * da; 29 } 30 while (cntb--) { 31 pb += pow(10, cntb) * db; 32 } 33 cout << pa + pb << endl; 34 35 return 0; 36 }
标签:乙级 turn namespace return += ace span space include
原文地址:https://www.cnblogs.com/moujun1001/p/9352137.html