Page 9 of 9

Re: Why having WA with UVa 10340- All in All

Posted: Wed Jul 16, 2014 2:11 pm
by lighted
It will be good if always remove your code after getting accepted. 8)

I'm getting WA on 10340 - All in All

Posted: Wed Aug 20, 2014 6:14 pm
by azisak
Thanks lighted and brianfry! :D

Re: I'm getting WA on 10340 - All in All

Posted: Wed Aug 20, 2014 7:53 pm
by lighted
Change reading to

Code: Select all

 while (cin>>subkal>>kal){
Don't forget to remove your code after getting accepted. 8)

Re: I'm getting WA on 10340 - All in All

Posted: Wed Aug 20, 2014 8:52 pm
by brianfry713
Don't use cin.eof(), there will be a newline char at the end of the last line in the judge's input.
Next time post in an existing thread.

Re: 10340 - All in All

Posted: Tue Jan 27, 2015 11:44 pm
by Xenon Kfr
why WA ?

Code: Select all

#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    while(cin>>s>>t)
    {
        if(cin.eof())
            return 0;
        int temp=0,yes=1,j;
        if(s.size()>t.size())
        {
            yes=0;
        }
        else if(s.size()==t.size())
        {
            if(s==t)
                yes=1;
            else
                yes=0;
        }
        else
            for(int i=0; s[i]; i++)
            {
                for(j=temp; t[j]; j++)
                {
                    if(s[i]==t[j])
                    {
                        temp=j;
                        break;
                    }
                    else if(j==t.size()-1)
                    {
                        yes=0;
                        break;
                    }
                }
//            if(j==t.size() && temp)
//            {
//                yes=0;
//                break;
//            }

            }
        if(yes==1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}


Re: 10340 - All in All

Posted: Thu Jan 29, 2015 2:13 am
by brianfry713
Try input: aa abb

Re: 10340 - All in All

Posted: Mon Feb 09, 2015 11:07 am
by tahmidrana
Got AC jst after posting here. :)

Re: 10340 - All in All

Posted: Tue Feb 10, 2015 1:38 am
by brianfry713
That is AC code.

Re: 10340 - All in All

Posted: Tue Aug 25, 2015 7:01 am
by prokawsar
Accepted :D .

Code: Select all

Code Removed

Re: 10340 - All in All

Posted: Wed Aug 24, 2016 10:24 pm
by astandrik
Can anyone see why is it WA? All test cases are OK.

Code: Select all

import sys
def findSubstr(s1, s2):
    if(len(s2) == 0) or (len(s1) > len(s2)):
        return False
    elif s1[0] == s2[0] and len(s1) == 1:
        return True
    elif s1[0] == s2[0] and len(s1) > 1:
        return findSubstr(s1[1:], s2[1:])
    elif s1[0] != s2[0]:
        return findSubstr(s1,s2[1:])
try:
    while 1:
        line = sys.stdin.readline()
        inf = list(str(line).split())
        s1 = inf[0]
        s2 = inf[1]
        res = 'Yes' if findSubstr(s1,s2) else 'No'
        print(res)
except:
    exit(0)