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

3xs,把j用一个字符表示,ft~~~~~~~~

Posted by sunmoonstar_love at 2005-07-17 20:36:22 on Problem 2334
In Reply To:Re:谢谢你,不过还是不明白,小于10 +1, 小于100+2?有问题么? Posted by:00448242 at 2005-07-17 20:34:13
> Source
> 
> Problem Id:2334  User Id:00448242 
> Memory:40K  Time:108MS
> Language:G++  Result:Accepted
> 
> Source 
> 
> #include <stdio.h>
> #include <string.h>
> int n,i,lenc,lenl,res,tmp;
> char last[300],curr[300];
> int bit(int a)
> {
>     int ans = 1;
>     while(a>=10)
>     {
>         ans++;
>         a = a/10;
>     }
>     return ans;
> }
> int main()
> {
>     scanf("%d",&n);
>     res = 0;
>     scanf("%s",last);
>     if(n==1)
>     {
>         printf("%d\n",strlen(last));
>         return 0;
>     }
>     res += (lenl=strlen(last));
>     n--;
>     while(n--)
>     {
>         scanf("%s",curr);
>         lenc = strlen(curr);
>         tmp = lenc>lenl?lenl:lenc;
>         for(i=0; i<tmp; i++)
>             if(last[i]!=curr[i])
>                 break;
>         res += lenc - i + 1;
>         lenl = lenc;
>         strcpy(last,curr);
>     }
>     printf("%d\n",res);
>    // scanf("\n");
>     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