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

看過大大們的解題思路還WA 2之...慚愧之!

Posted by ytlau9 at 2010-07-05 22:05:43
此為AC碼...

#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;

int main(){
        char c;
        long long i,max=0,no=0,tmp=0;
                while(c=getchar(),c!=EOF){
                        if(c =='\n'){
                                if(no==0){
                                        printf("2\n");
                                }
                                else{
                                        for(i=max+1;i<=62;i++)
                                                if(no%(i-1)==0){
                                                        printf("%lld\n",i);
                                                        break;
                                                }
                                        if(i>62) printf("such number is impossible!\n");
                                }

                                 max = no =tmp= 0;
                        }
                        else if(c>='0'&& c<='9'){
                                tmp = c-'0';
                                no+= tmp;
                        }
                        else if(c>='A' &&c<='Z'){
                                tmp = c-'A'+10;
                                no+=tmp;
                        }
                        else if(c>='a' && c<='z'){
                                tmp = c-'a'+36;
                                no+=tmp;
                        }
                        if(tmp>max) max = tmp;
                }
        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