Page 3 of 3
Re: 10812 - Beat the Spread!
Posted: Fri Sep 20, 2013 8:44 pm
by k23456
guys i need help i dnt have any idea what's wrong with my code it works perfectly
#include <iostream>
using namespace std;
int main(){
long int a,b,t;
cin>>t;
while(t--){
cin>>a>>b;
long int s=(a+b)/2,m=(a-b)/2;
if(s>0 && m>0){
cout<<s<<m<<endl;}
else
cout<<"impossible"<<endl;
}
}
after submitting the code they keep on showing that the ans is wrong
Re: 10812 - Beat the Spread!
Posted: Fri Sep 20, 2013 9:59 pm
by brianfry713
There should be a space in between numbers in the output
Re: 10812 - Beat the Spread!
Posted: Tue Oct 15, 2013 10:28 pm
by c000p
Anybody please help me...
Why am I getting Runtime Error...
Why RE occur??
Re: 10812 - Beat the Spread!
Posted: Wed Oct 16, 2013 8:25 pm
by brianfry713
Re: 10812 - Beat the Spread! why i get WA pls help me
Posted: Sat Jan 04, 2014 10:09 am
by cse dipto
Code: Select all
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stack>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int main()
{
long long int i,j,k,t_case,a,b,r,r1,R,R1;
cin>>t_case;
for(i=1;i<=t_case;i++)
{
cin>>a>>b;
if(b>a)
{
printf("impossible\n");
}
else if(a>b)
{
r=a+b;
r1=r/2;
j=a-b;
k=j/2;
if((r1*2)==r&&(k*2)==j)
{
R=((a+b)/2);
R1=((a-b)/2);
printf("%lld %lld\n",R,R1);
}
else
{
printf("impossible\n");
}
}
}
return 0;
}
Re: 10812 - Beat the Spread!
Posted: Wed Jan 15, 2014 12:39 am
by brianfry713
brianfry713 wrote:Input:
Output should be: