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

弄个映射函数果然可以省去很多代码。hoho~~

Posted by guanqun at 2007-07-02 20:31:24 on Problem 1102
int aux_func(int n, int s)
{
    if(n==0)
        return 0;
    if(n>0 && n<s+1)
        return 1;
    if(n==s+1)
        return 2;
    if(n>s+1 && n<s+s+2)
        return 3;
    if(n==s+s+2)
        return 4;
}

然后:
putchar(table[n[ni]-'0'][aux_func(i, s)][aux_func(j, s)]);

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