UVa Problem (Train Swapping) 299 Solution in Java

UVa Problem (Train Swapping) 299 Solution in Java

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) 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 640 ( Self Numbers) Solution

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

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

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  10347 ( Medians) Solution

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 10522 Solution

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

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

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 10991(Region) Solution

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 10341 – Solve It  Solution

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

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

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

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...