UVa-424-Integer Inquiry
2014-08-09 17:26
393 查看
AOAPC
I: Beginning Algorithm Contests (Rujia Liu) :: Volume
1. Elementary Problem Solving :: Big
Number
I: Beginning Algorithm Contests (Rujia Liu) :: Volume
1. Elementary Problem Solving :: Big
Number
// 424 - Integer Inquiry #include <iostream> #include <cstring> using namespace std; int main(void) { char s[200]; // at most 100 lines of text int i, k, n, carry, a[200], t[200]; memset(a, 0, sizeof(a)); while(cin>>s && s[0]!='0') { k = 0; carry = 0; memset(t, 0, sizeof(t)); for(i=strlen(s)-1; i>=0; i--) t[k++] = s[i] - '0'; for(i=0; i<200; i++) { carry += t[i] + a[i]; a[i] = carry % 10; carry /= 10; } } n = 200; while(!a[--n]); for(i=n; i>=0; i--) cout << a[i]; cout << endl; return 0; }
相关文章推荐
- UVA424 Integer Inquiry
- UVA - 424 Integer Inquiry
- UVa-424-Integer Inquiry
- uva 424 - Integer Inquiry
- uva 424 - Integer Inquiry
- UVa 424 Integer Inquiry
- UVA 424 Integer Inquiry
- UVa 424 - Integer Inquiry
- UVa 424 Integer Inquiry
- UVa:424 - Integer Inquiry
- UVa 424 - Integer Inquiry
- uva 424 - Integer Inquiry
- UVa 424 - Integer Inquiry
- UVa 424 - Integer Inquiry
- UVA - 424 - Integer Inquiry
- uva-424 - Integer Inquiry
- UVa 424 Integer Inquiry
- UVA bignumber 424 integer inquiry
- UVa 424 - Integer Inquiry
- UVA - 424 Integer Inquiry