hi i am trying to solve this problem spoj.pl/problems/BISHOPS/
i have solved it and am getting the right answers but the judge keeps saying (wrong answer)
i know that the maximum number of bishops is 2*n-2 so it should be right
am not asking anyone to do my homework .... i have spent alot of time on this one and it should be correct
this is my code .... i hope someone would help
#include <iostream>
int main(){
using namespace std;
int x;int i;int sum;
char s[106];
while (cin>>s) {
i = 0;
sum = 0;
x = s[i] - 48;
while (x >0){
sum = sum*10 + x;
;
i++;
x = s[i] - 48;
}
cout<<(2*sum-2)<<"\n";
}
return 0;
}