| ||||||||||
| 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:怎么可能会出错?In Reply To:怎么可能会出错? Posted by:sunpy at 2008-08-02 17:15:12 > #include<stdio.h>
>
> #define N 4
>
> char a[N],b[N];
>
> int main()
> {
> int testcase;
> scanf("%d",&testcase);
> while(testcase--)
> {
> int s=0,d=0;
> scanf(" %s %s",a,b);
> int i,j;
> for(i=0;i<N;i++)
> for(j=0;j<N;j++)
> {
> if(i==j&&a[i]==b[j])
> s++;
> else if(i!=j&&a[i]==b[j])
> d++;
> }
> printf("%dA%dB\n",s,d);
> }
> return 0;
> }
我搞了半个小时,才发现是把N定义成5才能AC。应该G++编译器,字符串读取包括结束符~
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator