The Game Is On
Wednesday 4 February 2015
Friday 30 January 2015
Solution of spoj Naya Shatranj (New Chess) CODCHESS
#include<iostream>
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cin>>n;
if(n%2==0)
cout<<"1"<<endl;
else
cout<<"0"<<endl;
}
return 0;
}
using namespace std;
int main()
{
long int t,n;
cin>>t;
while(t--)
{
cin>>n;
if(n%2==0)
cout<<"1"<<endl;
else
cout<<"0"<<endl;
}
return 0;
}
SPOJ solution of CHOTU ( FARIDI AND YADAV)
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
int t;
double x,y,s;
cin>>t;
while(t--)
{
cin>>x>>y;
s=sqrt(pow(x,2)-pow(y,2));
s=s*2;
cout<<fixed<<setprecision(3)<<s<<endl;
}
return 0;
}
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
int t;
double x,y,s;
cin>>t;
while(t--)
{
cin>>x>>y;
s=sqrt(pow(x,2)-pow(y,2));
s=s*2;
cout<<fixed<<setprecision(3)<<s<<endl;
}
return 0;
}
Subscribe to:
Posts (Atom)