https://www.devskill.com/CodingProblems/ViewProblem/20
using System;
public class Exercise8
{
public static void Main()
{
int t=Convert.ToInt32(Console.ReadLine());
for(int i=1;i<=t;i++){
string s=Console.ReadLine();
string[] values=s.Split(' ');
double Cx=double.Parse(values[0]);
double Cy=double.Parse(values[1]);
double R=double.Parse(values[2]);
double Px=double.Parse(values[3]);
double Py=double.Parse(values[4]);
double ds=((Cx-Px)*(Cx-Px))+((Cy-Py)*(Cy-Py));
double d=Math.Pow(ds,0.5);
if(d<R)
{
Console.WriteLine("Case "+i+": Inside");
}
else if(d<=R)
{
Console.WriteLine("Case "+i+": OnCircle");
}
else{
Console.WriteLine("Case "+i+": Outside");
}
}
}
}
using System;
public class Exercise8
{
public static void Main()
{
int t=Convert.ToInt32(Console.ReadLine());
for(int i=1;i<=t;i++){
string s=Console.ReadLine();
string[] values=s.Split(' ');
double Cx=double.Parse(values[0]);
double Cy=double.Parse(values[1]);
double R=double.Parse(values[2]);
double Px=double.Parse(values[3]);
double Py=double.Parse(values[4]);
double ds=((Cx-Px)*(Cx-Px))+((Cy-Py)*(Cy-Py));
double d=Math.Pow(ds,0.5);
if(d<R)
{
Console.WriteLine("Case "+i+": Inside");
}
else if(d<=R)
{
Console.WriteLine("Case "+i+": OnCircle");
}
else{
Console.WriteLine("Case "+i+": Outside");
}
}
}
}
No comments:
Post a Comment