| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:这个输入是YES 吗?我认为程序不对啊。In Reply To:希望有热心人帮忙看一下,呜呜、、不知道为什么一直 wrong~ 提前说:谢谢了! Posted by:SWUST_smiles at 2010-08-07 20:39:47 > #include<iostream>
> using namespace std;
> #include<cstring>
> char a[2][102];
> int main()
> {
> int i,j,l;
> int n[2][26]={0};
> scanf("%s",a);
> scanf("%s",a+1);
> l=strlen(a[0]);
> for(i=0;i<l;i++)
> {
> n[0][a[0][i]-'A']++;
> n[1][a[1][i]-'A']++;
> }
> for(i=0;i<26;i++)
> {
> for(j=0;j<26;j++)
> {
> if(n[0][i]==n[1][j])
> {
> n[1][j]=0;
> break;
> }
> }
> if(j==26)
> {
> printf("NO\n");
> break;
> }
> }
> if(i==26)
> printf("YES\n");
> return 0;
> }
>
> 上面是AC的程序。。但我认为输入是ABBCCC
> ABBCCC 的时候程序时输出YES的 ,可这明显不对啊。。
>
> 我是不是没理解对 ,,帮忙解释下啊
把o[100]换成o[101] 试试
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator