标签:leave vector mat false splay return gen pre orm
1001 A+B Format
aa
1 #include<iostream> 2 #include<stdio.h> 3 #include<string> 4 #include<string.h> 5 #include<algorithm> 6 #include<list> 7 #include <sstream> 8 #include<math.h> 9 #include<vector> 10 #include<map> 11 #include<set> 12 using namespace std; 13 int main() { 14 int a, b; cin >> a >> b; 15 int sum = a + b; 16 string s = std::to_string(sum); 17 bool falg = false; 18 if (s[0] == ‘-‘) 19 { 20 falg = true; 21 s.erase(0, 1); 22 } 23 int count = 0; 24 for (int i=s.length()-1; i>=0; i--) { 25 if ( i-1 >= 0) { 26 count++; 27 if (count == 3) { 28 s.insert(i, ","); 29 count = 0; 30 } 31 } 32 else 33 break; 34 } 35 if (falg) 36 s.insert(0, "-"); 37 cout << s; 38 system("pause"); 39 return 0; 40 }
1002 A+B for Polynomials
aa
1003 Emergency
aa
1004 Counting Leaves
aa
1005 Spell It Right
aa
标签:leave vector mat false splay return gen pre orm
原文地址:https://www.cnblogs.com/yidiandianwy/p/11553114.html