Thursday, August 7, 2014

All topics Hadoop AWS mobile femina shop games Java Android iOS Swift intelligent hardware Docker O


@ This problem is mainly adding large numbers! Note, however, there is a decimal point! Format of the output is also very strict! WA many times, because not take into account all circumstances .00 added! #include "iostream" #include "string" #include "memory.h" #include "cctype" #include "algorithm" using namespace std; int temp [20], ans [20]; int main () {int N, i, j, k, len, count; string input, output; while (cin >> N && N) {output = ""; memset (ans, 0, sizeof (ans)); for (i = 0; i < N; i ++) {cin >> input; memset (temp, 0, sizeof (temp)); len = input.length (); for (j = 0, count = 0; j <len; j ++) // characters converted into digital {if (isdigit (input [len-1-j])) {temp [count] = input [len-1-j] - 48; count ++;}} for (j = 0; j <20; j ++ ) // adding large numbers of general practice! {Ans [j] = temp [j] + ans [j]; ans [j + 1] + = ans [j] / 10; ans [j] = ans [j]% 10;}} for (j = 0 ; j <20; j ++) if (ans [20-1-j] = 0) break; k = 20-1-j; k = k!> = count-1 k:? count-1; // determine whether Ignore the leading femina shop 0, this requires special attention, it is easy to make mistakes! for (j = 0, i = 1; j <= k; j ++, i ++) // output format! {Output + = ans [j] + 48; if (j == 1) {output + = "."; I = 0;!} If (i% 3 == 0 && i = 0 && i = k-! 1) {output + = ",";}} output + = "$"; reverse (output.begin (), output.end ()); cout << output << endl;} return 0;} / * 3 $ 11,999,999.99 $ 99,999,999.99 $ 111,999,999.11 3 $ 0.00 $ 0.00 $ 0.00 * /
All topics Hadoop AWS mobile femina shop games Java Android iOS Swift intelligent hardware Docker OpenStack VPN Spark ERP IE10 Eclipse CRM JavaScript database Ubuntu NFC WAP jQuery BI HTML5 Spring Apache .NET API HTML SDK IIS Fedora XML LBS Unity Splashtop UML components Windows Mobile Rails QEMU KDE Cassandra CloudStack FTC coremail OPhone CouchBase cloud iOS6 Rackspace Web App SpringSide Maemo Compuware large data aptech Perl Tornado Ruby Hibernate ThinkPHP HBase Pure Solr Angular Cloud Foundry femina shop Redis Scala Django Bootstrap
Read the Top c ++ Detailed in string class (3206) Manacher algorithms: Solving the longest palindrome string, femina shop the time complexity femina shop of the splash screen splash screen is O (N) (3204) VS2008 add the program (2018) four operations femina shop of Tarsus C ++ implementation (1727) four arithmetic expression evaluator (stack application) (1333) poj 1002 487-3279 (1289) and the sort of difference qsort Detailed and comparison function (1181) Zhongshan University SICILY classification (1163) Analysis of C ++ The three input methods (1010) Cantor expansion formula (996)
Micros incremental linker error (2) poj 1484 Blowing Fuses (1) Detailed comments Tarsus Four ranked c ++ the string class (2) four arithmetic expression evaluator (the stack of applications) (2) appears in vs 2008 mfc operation of C ++ achieve (1) zoj 2727 List the Book (1) qsort and sort of the difference femina shop between Detailed and comparison femina shop functions femina shop (1) Analysis of C ++ the three input methods (1) poj 1326 Mileage femina shop Bank (0) poj 2247 Humble Numbers (0)


No comments:

Post a Comment