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

Posted by xiaorong at 2010-12-09 00:02:23 on Problem 2159
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <cstdlib>
#include<algorithm>

using namespace std;
int main()
{ 
    char s[100],t[100],l[100];
    int i,k;
    scanf("%s%s",s,t);
    k=strlen(s);
    for(i=0;i<k;i++)
        if(s[i]=='A')  l[i]='Z';
        else l[i]=s[i]-1;
    l[i]='\0';
    sort(t,t+k);
    sort(l,l+k);
    for(i=0;i<k;i)
        if(t[i]==l[i++]);
        else break;
    if(i=k)
        printf("YES\n");
    else printf("NO\n");
    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