UVa Problem (Train Swapping) 299:Train Swapping is a basic problem on UVa online judge for novice problem solver.You can find details on this Link. import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @Date : Oct 6, 2016 * @Time : 9:24:33 PM */ public...
UVA Problem 109 ( SCUD Busters) Solution
UVA Problem 109 ( SCUD Busters) : This problem is UVA uhunt book chapters (Computational Geometry problem) category problem. link: http://uva.onlinejudge.org/external/1/109.html Problem Description: Find each convex hull for each area then select that...
UVA Problem 476 (Points in Figures Rectangles) Solution
UVA Problem 476 (Points in Figures Rectangles) : This problem is UVA uhunt book chapters (Computational Geometry problem) category problem. Details link: http://uva.onlinejudge.org/external/1/476.html Problem Description: This is a straightforward problem....
UVA Problem 640 ( Self Numbers) Solution
UVA Problem 640 ( Self Numbers): Is a basic UVa problem. Details link: Problem Details: This is a Straightforward problem. problem solution: #include <stdio.h> #include <math.h> int d[1000010]; int generator(int num) { int sum = num;...
UVA Problem 10137 (The trip) Solution
#include <bits/stdc++.h> using namespace std; double arr[1020]; int main() { // double P=0,N=0,F,S,T; int n,i,j; while(cin>>n && n) { double avg=0; for(i=0;i<n;i++) { scanf("%lf",&arr[i]); avg += arr[i]; } avg /= n; double P = 0, N =...
UVA Problem 10221 ( Satellites) Solution
#include<bits/stdc++.h> #define PI acos(-1) using namespace std; int main () { double dis_of_sate ,angle,r; char s[4]; while(cin>>dis_of_sate>>angle>>s) // circle (arc) length s=r*theta. (chord) length = 2*rsin(C/2) { if(s[0]=='m') angle/=60;...
UVA Problem 10286 (Trouble with a Pentagon) Solution
#include <bits/stdc++.h> #include <math.h> #define pi acos(0.0) //#define pi 3.1416 int main() { double n; while(scanf("%lf",&n) != EOF ) { //poligon_inte_angle = (3/5)*180=(108 degree)as figure sides n=5; //square_inte_angle = (2/4)*90=(63...
UVa Problem 10347 ( Medians) Solution
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { double a,b,c,ans,s; while(scanf("%lf %lf %lf",&a,&b,&c) == 3 ) { s=(a+b+c)/2; ans=sqrt(s*(s-a)*(s-b)*(s-c)); if(ans>0) printf("%.3lf\n",ans*(4.0/3.0)); else...
UVA Problem 10451 (Ancient Village Sports) Solution
#include <bits/stdc++.h> #include<iostream> #include<math.h> #define pi 2*acos(0.0) using namespace std; int main() { double n,x,y,a,R,r,A,A1,A2,spect,offic; int c=0; while(scanf("%lf %lf",&n,&A)==2 && n>=3) {...
UVA Problem 10522 Solution
#include <bits/stdc++.h> #include <cmath> using namespace std; int main() { int tc; cin>>tc; while (tc) { double ha, hb, hc,a,b,c;//s,s1,a1,b1,c1,a,b,c; scanf("%lf%lf%lf", &ha, &hb, &hc); a=1/ha,b=1/hb,c=1/hc; double s1=(a +...
UVA Problem 10573 Solution
#include <bits/stdc++.h> #define PI 2*acos(0) using namespace std; int main() { int n,tc,i,j; char t[2]; cin>>tc; while(tc--) { int a,b; cin>>a; if(getchar()=='\n') { printf("%.4lf\n", (2*a*a*PI)/16); } else { cin>>b;...
UVA Problem 10589 (Area) Solution
#include <bits/stdc++.h> using namespace std; int main() { int N,a,M,rr; double x,y; while(scanf("%d %d",&N,&a)!=EOF && N) { bool f = true; M = 0; rr = a*a; for(int i = 0;i<N;++i) { scanf("%lf %lf",&x,&y); f = true;...
UVA Problem 10678 (The Grazing Cow) Solution
#include <bits/stdc++.h> #define PI 2*acos(0) using namespace std; int main() { double d,l,D,L,i,r1,r2; int tc; double ans; cin>>tc; while(tc--) { cin>>D>>L; d=D/2.0; l=L/2.0; r1=sqrt((L/2 * L/2) - (D/2 * D/2));...
UVA Problem 10991(Region) Solution
#include<bits/stdc++.h> #include <iostream> #include<math.h> using namespace std; int main() { double c1,c2,c3,a,b,c,s,ang1,ang2,ang3,arc1,arc2,arc3,area,area1,area2; int tc; scanf("%d",&tc); while(tc--){...
UVA Problem 10254 ( The Priest Mathematician) Solution
#include <bits/stdc++.h> using namespace std; int main() { int s,n; int first_term,last_term; while (scanf("%d", &s), s != -1) { int n_sum =(int)sqrt(2*s); for (n = n_sum ; n > 0; n--) { if ( (2 * s + n - n * n) % (2 * n) == 0 ) { first_term...
UVA Problem 10401 – Injured Queen Problem Solution
#include <stdio.h> long int arr[1000002]; void array () { long int k=0,i; arr[3]=0; for( i = 4; i <= 1000000; i++) { k = k + ((i-2)/2); arr[i] = arr[i-1] + k; } } int main() { //array(); long int n; array(); while(scanf("%ld",&n) &&...
UVA Problem 10341 – Solve It Solution
#include <cstdio> #include <cmath> using namespace std; int main() { int T,p,q,r,s,t,u; double lo,hi,mi,f; while(scanf("%d %d %d %d %d %d",&p,&q,&r,&s,&t,&u)==6) { if(p*exp(-1)+q*sin(1)+r*cos(1)+s*tan(1)+t+u>1e-9 || p+r+u<0) {...
UVA Problem Uva 369 – Combinations Solution
#include <bits/stdc++.h> using namespace std; long double func_tion (long double n) { long double i,r = 1; for ( i = 2; i <= n; i++) { r *= i; } return r; } int main () { long double M, N,r,n,m; while (cin>>N>>M) { if( N==0 and M==0...
UVA Problem 621 ( Secret Research ) Solution
#include <bits/stdc++.h> using namespace std; int main() { int tc; char s[2000],l; cin>>tc; while (tc--) { scanf("%s", s); l = strlen(s); if (strcmp(s, "1") == 0 || strcmp(s, "4") == 0 || strcmp(s, "78") == 0) printf("+\n"); else if ( s[l -...
UVA Problem 846 Steps Solution
#include<bits/stdc++.h> using namespace std; int main() { double n; int cases; int cont=0; while(cin>>n){ cont=0; for(cases=1;;) { if((cases%2)==1) { n/=9; cont++; } else { n/=2; cont++; } if(n<=1) { break; } cases++; } if(cont%2==1) printf("Stan...
The Enduring Power of PHP: Why It’s Still Thriving in 2025 and Beyond
Despite frequent predictions of its demise, PHP remains a cornerstone of web development. Discover why this ‘immortal’ language continues to evolve and power millions of websites.
Mastering IELTS Speaking: Strategies & Band 9 Tips for November 2025 (Germany Focus)
Prepare for your IELTS Speaking test with expert strategies, potential November 2025 question insights, and essential tips to achieve a Band 9 score, especially for test-takers in Germany.
Laravel’s Power: Unlocking Large-Scale Projects with DDD & The New Cloud API
Explore how Laravel excels in large-scale applications, integrates with Domain-Driven Design, and the exciting potential of the new Laravel Cloud API.
Python’s Dominance: Powering the Future of Data Science and AI
Discover why Python is the undisputed leader in data science, exploring its key advantages, essential libraries, and profound impact on AI, machine learning, and data-driven innovations.




