Yeah, just as @codename007 said, the statement stated that the number will be positive. I am quite certain, 0000.0000 or 0 is not a positive number. Right?
1 2 e 9 i 8 8 0 ei for this test case your answer outputs 57 it should be 98. also it gives WA for many of the test cases. Try a bit more, you can get it correct.
check your code here http://ideone.com/gXgNOa
dont you think output of string 001800 should be 1800
ā¦
check your code http://ideone.com/vwfLid
output should be 100
earlier i was also doing the same mistakeā¦@sanzzzay pointed it out
@m1sterzer0 after reading your answer aboveā¦out of curiosity i checked your submission for the problemā¦ i dont know why its giving the wrong output instead of being accepted as right answer http://ideone.com/z1YyRR
@grvana for your helpā¦i corrected the mistake you pointed outā¦but there still seems to be some prob as the code still gives WA on submittingā¦Revised code http://www.codechef.com/viewsolution/4139033
http://www.codechef.com/viewsolution/3999376
This is my solution it is passing every case mentioned in the problem and every corner case as well. What is the problem here?
I am getting wrong answer errorā¦ please helpā¦
#include < iostream>
#include < string>
using namespace std;
int main()
{
int n;
cin>>n;
string enPass,Pass;
while(n>0)
{
int r,counter=0;
cin>>r; // no. of rules.
char c[r],p[r];
for(int i=0;i<r;i++)
{
cin>>c[i]>>p[i]; // taking each rule as input
}
cin>>enPass; // taking encrypted password as input
Pass = enPass;
for(int j=0;j<enPass.size();j++)
{
for(int s=0;s<r;s++)
{
if(c[s] == enPass[j])
{
Pass[j] = p[s];
}
}
}
int str_Size = Pass.size();
for(int q = str_Size-1; q >= 0; q--)
{
if(Pass[q] == '0') Pass.erase(q);
else if(Pass[q] == '.')
{
Pass.erase(q);
break;
}
else break;
}
for(int t=0;t<str_Size;t++)
{
if(Pass[t] == '0') counter++;
else break;
}
Pass.erase(0,counter);
cout<<Pass<<"\n";
n--;
}
return 0;
}
I have checked all the test cases. but i am still not able to get successful submission.
http://www.codechef.com/viewsolution/5135021
I cracked this after trying different print techniques for the output.
First, I print the op as separate characters(i.e every single S[i] using loop). This didnāt work out. Secondly, I print the op as integers(using S[i]-ā0ā except for ā.ā). This didnāt work out as well. Finally after going through the solution of @pummy02(https://www.codechef.com/viewsolution/7934954) I got a hint. I assigned the 'last+1āth char as null and printed the op as a string. This worked out!
Can somebody help me with this solution, this gives correct answer for all the given tc but on submission gives wa.
https://www.codechef.com/viewsolution/14346300