Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
尝试一种新方法#include <iostream> #include <stdio.h> #include <string> #include <string.h> using namespace std; char ch[3][100] = {"15762679542071167858843489", "24332675219681431451788241", "28992087708416717612934417"}; int main() { int a,b,c; while(cin>>a>>b>>c) { int ans[100]={0}; int l1,i; l1=strlen(ch[0]); for(i=0;i<l1;i++) { ans[i] += (ch[0][i] -'0') *a; ans[i] += (ch[1][i] -'0') *b; ans[i] += (ch[2][i] -'0') *c; } for(i=l1-1;i>=1;i--) { ans[i-1] += ans[i]/10; ans[i] %= 10; } for(i=0;i<l1;i++) { cout<<ans[i]; } cout<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator