Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

尝试一种新方法

Posted by tang123456 at 2011-12-08 17:45:18 on Problem 3982
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator