UVA Solution 438 - The Circumference of the Circle - Volume 4
UVA Online Judge Solution 438 - The Circumference of the Circle| Volume 4
UVA Problem Link - https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=6&page=show_problem&problem=379
Problem Name: 438 - The Circumference of the Circle
Problem Number : UVA - 438 - The Circumference of the Circle
Online Judge : UVA Online Judge Solution
Volume: 4
Solution Language : C plus plus
UVA Solution 438 - The Circumference of the Circle Code in CPP:
#include <stdio.h> #include <math.h> struct Point { double x, y; }; double cross(Point &o, Point &a, Point &b) { return (a.x-o.x)*(b.y-o.y) - (a.y-o.y)*(b.x-o.x); } double dist(Point &a, Point &b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { Point a, b, c; double R, area, pi = acos(-1); while(scanf("%lf %lf", &a.x, &a.y) == 2) { scanf("%lf %lf", &b.x, &b.y); scanf("%lf %lf", &c.x, &c.y); area = fabs(cross(a, b, c))/2; R = dist(a, b)*dist(b, c)*dist(c, a)/4.0/area; printf("%.2lf\n", 2*pi*R); } return 0; }
Tags: UVA Online Judge Solution, UVA OJ Solution list, UVA Problems Solution, UVA solve 438 - The Circumference of the Circle, UVA all problem solution list, UVA The Circumference of the Circle438 code in C, UVA code in C++, UVA 438 solution in C, UVA The Circumference of the Circle solution
No comments:
Post a Comment