ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1493. One Step from Happiness

why i have compilitation error?
Posted by Husan 28 Nov 2006 17:26
#include<iostream.h>
#include<math.h>
#include<stdlib.h>
bool prov(char s[10])
{
int k1=0,k2=0;

k1=s[0]-'0'+s[1]-'0'+s[2]-'0';

k2=s[3]-'0'+s[4]-'0'+s[5]-'0';

if(abs(k2-k1)==1)return true;else return false;

}
int main()
{
char s[10],str1[10];
int pr=0,k1,k2;
cin>>s;
if(prov(s)==true)
{
ltoa(atol(s)+1,str1,10);
k1=str1[0]-'0'+str1[1]-'0'+str1[2]-'0';
k2=str1[3]-'0'+str1[4]-'0'+str1[5]-'0';
if(k1==k2)pr=1;

ltoa(atol(s)-1,str1,10);
k1=str1[0]-'0'+str1[1]-'0'+str1[2]-'0';
k2=str1[3]-'0'+str1[4]-'0'+str1[5]-'0';
if(k1==k2)pr=1;

if(pr==0)cout<<"No";else cout<<"Yes";
}else cout<<"No";

return 0;


}

Re: why i have compilitation error?
Posted by <>|>|/|<|>>|<<>|-| 25 Feb 2007 11:27
Bu naqani maslahat bermayman

Edited by author 25.02.2007 11:27

Edited by author 25.02.2007 11:27
445219
Posted by kichkina shaxzoda 22 Dec 2011 18:27
445219 da nimaga No 4+4+5<=>2+1+9 yani 13 va 12