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

缓存ENIENIENI

Posted by ENI at 2010-11-01 14:25:54
#include<iostream>
#include<math.h>
#include<cstring>
using namespace std;

char* dao(char* num,int len)
{
    int i;
    char tmp[len];
    for (i=0;i<len/2;i++) 
    {
        tmp[i]=num[len-1-i];
        num[len-1-i]=num[i];
        num[i]=tmp[i];
    }
    return num;
}
char* add(char* s,int len)
{
    int i,w=0;
    char tmp[500000];
    s=dao(s,len);
    cout << s<<endl;
    system("pause");
    for (i=0;i<len;i++)
    {
        if (s[i]='0') break;
        tmp[i]=tmp[i]+1;
        w=s[i]+s[i];
        if (w>105) {w=1; tmp[i]=tmp[i]+(w-96);} else {w=0; tmp[i]=tmp[i]+(w-106);}
    }
    return tmp;         
}
//MAIN
int main()
{
    int len,i;
    char num[500000];
    for(i=0;i<500000;i++) num[i]='0';
    cin >> num;
    len=strlen(num);
    cout <<add(num,len)<<endl;
    system("pause");
    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