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 taozifish at 2012-07-23 14:09:49 on Problem 3095
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main(){
    char str[100];
    while(scanf("%s", str)&&str[0]!='#'){
        int flag=1, ans=0, len=strlen(str), t=0, i;
        for(i=0; i<len; i++){
            switch(str[i]){
                case '/':if(flag)ans+=100;flag=0;break;
                case '\\':t=100;break;
                case '.':ans+=t+100;t=0;flag=1;break;
                case '_':break;
                case '|':if(flag)ans+=50;flag=0;t=50;break;
            }
        }
        printf("%d\n", (ans+t)/len);
    }
    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