buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
import math a,b,h,m=map(int,input().split()) lrad=6*m srad=30*h+0.5*m if abs(lrad-srad)<=180: do=abs(lrad-srad) else: do=abs(lrad-srad)-180 rad=math.radians(do) print(math.sqrt(a**2+b**2-2*a*b*math.cos(rad)))
import math a,b,h,m=map(int,input().split()) lrad=6*m srad=30*h+0.5*m if abs(lrad-srad)<=180: do=abs(lrad-srad) else: do=360-abs(lrad-srad) rad=math.radians(do) print(math.sqrt(a**2+b**2-2*a*b*math.cos(rad)))
[["+", 8, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
102
import sys import math a,b,h,m=map(int,input().split()) f=h/12*360-m/60*260+m/60/12*360 print((a**2+b**2-2*b*a*(math.cos(math.radians(f))))**(0.5))
import sys import math a,b,h,m=map(int,input().split()) f=h / 12 * 360 - m / 60 * 360 + m / 60 / 12 * 360 print((a**2+b**2-2*b*a*(math.cos(math.radians(f))))**(0.5))
[["-", 0, 662, 12, 657, 31, 657, 12, 657, 12, 612], ["+", 0, 662, 12, 657, 31, 657, 12, 657, 12, 612]]
5
81
a,b,h,m=map(float,input().split()) #時針の角度をA c=(30*h-11/2*m) ct=math.radians(c) cos=math.cos(ct) ans=a**2+b**2-2*a*b*abs(cos) print(math.sqrt(ans))
import math a,b,h,m=map(float,input().split()) #時針の角度をA c=abs(30*h-11/2*m) ct=math.radians(c) cos=math.cos(ct) ans=a**2+b**2-2*a*b*cos print(math.sqrt(ans))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 662, 12, 657, 12, 657, 12, 652, 63, 22], ["-", 12, 657, 12, 657, 12, 652, 3, 4, 0, 24], ["-", 12, 657, 12, 657, 12, 652, 3, 4, 0, 25]]
5
79
a, b, h, m = gets.split.map(&:to_i) theta = 1.0 * (60 * h - 11 * m).abs / 360 theta -= 1 if theta > 1 puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math::PI * theta))
a, b, h, m = gets.split.map(&:to_i) theta = 1.0 * (60 * h - 11 * m).abs / 360 theta = 2 - theta if theta > 1 puts Math.sqrt(a ** 2 + b ** 2 - 2 * a * b * Math.cos(Math::PI * theta))
[["-", 36, 36, 0, 493, 0, 751, 8, 755, 17, 110], ["-", 36, 36, 0, 493, 0, 751, 8, 755, 12, 612], ["+", 36, 36, 0, 493, 0, 751, 8, 662, 0, 32], ["+", 0, 493, 0, 751, 8, 662, 12, 738, 31, 612], ["+", 0, 493, 0, 751, 8, 662, 12, 738, 17, 33], ["+", 0, 493, 0, 751, 8, 662, 12, 738, 12, 22]]
4
71
import math a,b,h,m=map(int,input().split()) res=min(abs(h*30+m/2-m*6),abs(h*30-m/2-m*6-360)) ans=a**2+b**2-2*a*b*math.cos(res*math.pi/180) print(math.sqrt(ans))
import math a,b,h,m=map(int,input().split()) res=min(abs(h*30+m/2-m*6),abs(h*30+m/2-m*6-360)) ans=a**2+b**2-2*a*b*math.cos(res*math.pi/180) print(math.sqrt(ans))
[["-", 3, 4, 0, 657, 31, 657, 31, 657, 17, 33], ["+", 3, 4, 0, 657, 31, 657, 31, 657, 17, 72]]
5
95
A, B, H, M = list(map(int, input().split())) m = 360/60 * M h = 360/12 * (H + M/60) deg = abs(h-m) if deg>180: deg = 360-deg import math Csq = A**2 + B**2 - 2*A*B*math.cos(math.radians(deg)) print('{:.10f}'.format(math.sqrt(Csq))) print(deg)
A, B, H, M = list(map(int, input().split())) m = 360/60 * M h = 360/12 * (H + M/60) deg = abs(h-m) if deg>180: deg = 360-deg import math Csq = A**2 + B**2 - 2*A*B*math.cos(math.radians(deg)) print('{:.10f}'.format(math.sqrt(Csq)))
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
110
import numpy as np a,b,h,m = list(map(int,input().split())) theta = abs(h/12 - m/60)*2*np.pi print(np.sqrt((a*a+b*b-2*a*b*np.cos(theta))))
import numpy as np a,b,h,m = list(map(int,input().split())) theta = abs(h/12-11*m/720)*2*np.pi print(np.sqrt((a*a+b*b-2*a*b*np.cos(theta))))
[["+", 3, 4, 0, 657, 12, 657, 31, 657, 31, 612], ["+", 3, 4, 0, 657, 12, 657, 31, 657, 17, 48], ["-", 31, 652, 3, 4, 0, 657, 12, 657, 12, 612], ["+", 31, 652, 3, 4, 0, 657, 12, 657, 12, 612]]
5
75
A, B, H, M = map(int, input().split()) # 時針: 12時間720分で360度 1分で0.5度 # 分針: 60分で360度 1分で6度 theta = abs(((0.5 * (H * 60 + M)) - (6 * M)) % 360) if theta > 180: theta = 360 - theta print(theta) import math C = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(theta / 180 * math.pi)) print(C)
A, B, H, M = map(int, input().split()) # 時針: 12時間720分で360度 1分で0.5度 # 分針: 60分で360度 1分で6度 theta = abs(((0.5 * (H * 60 + M)) - (6 * M)) % 360) if theta > 180: theta = 360 - theta #print(theta) import math C = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(theta / 180 * math.pi)) print(C)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
101
import math a,b,h,m = map(int, input().split()) xh = a*math.cos((60*h+m)/720*math.pi) yh = a*math.sin((60*h+m)/720*math.pi) xm = b*math.cos(m/30*math.pi) ym = b*math.sin(m/30*math.pi) print( ((xh-xm)**2+(yh-ym)**2)**0.5 )
import math a,b,h,m = map(int, input().split()) xh = a*math.cos((60*h+m)/360*math.pi) yh = a*math.sin((60*h+m)/360*math.pi) xm = b*math.cos(m/30*math.pi) ym = b*math.sin(m/30*math.pi) print( ((xh-xm)**2+(yh-ym)**2)**0.5 )
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612]]
5
120
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; // ll mod = 998244353; #define rep(i, n) for (int i = 0; i < (n)...
#include <algorithm> #include <cmath> #include <deque> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <utility> #include <vector> using namespace std; typedef long long ll; ll mod = 1e9 + 7; // ll mod = 998244353; #define rep(i, n) for (int i = 0; i < (n)...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
195
import math a,b,h,m = map(int,input().split()) ang1 = (h%12+m/60) * 30 ang2 = m * 6 ang = abs(ang1-ang2) % 180 if ang > 180: ang = 360 - ang print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ang))))
import math a,b,h,m = map(int,input().split()) ang1 = (h%12+m/60) * 30 ang2 = m * 6 ang = abs(ang1-ang2) if ang > 180: ang = 360 - ang print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(ang))))
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
93
import math a,b,h,m = map(int, input().split()) s = 30 * h + m * 0.5 l = m*6 x = abs(s-l) if x >= 180: x -= 180 c = math.cos(math.radians(x)) print((a**2+b**2-2*a*b*c)**0.5)
import math a,b,h,m = map(int, input().split()) s = 30 * h + m * 0.5 l = m*6 x = abs(s-l) if x >= 180: x = 360-x c = math.cos(math.radians(x)) print((a**2+b**2-2*a*b*c)**0.5)
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
87
import math A,B,H,M=map(int,input().split()) c=abs(H*15-M*6) k=A*A+B*B-2*A*B*math.cos(c*math.pi/360) l=math.sqrt(k) print(l)
import math A,B,H,M=map(int,input().split()) c=abs(H*30-M*5.5) k=A*A+B*B-2*A*B*math.cos(c*math.pi/180) l=math.sqrt(k) print(l)
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 12, 612], ["-", 12, 652, 3, 4, 0, 657, 12, 657, 12, 612], ["+", 12, 652, 3, 4, 0, 657, 12, 657, 12, 531], ["-", 12, 657, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 12, 657, 12, 652, 3, 4, 0, 657, 12, 612]]
5
74
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repr(i, a, n) for (int i = n - 1; i >= a; i--) using namespace std; using ll = long long; using P = pair<int, int>; template <typename T> void chmin(T &a, T b) { a = min(a, b); } template <typename T> void chmax(T &a, T b) { a = max(a, b)...
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < n; i++) #define repr(i, a, n) for (int i = n - 1; i >= a; i--) using namespace std; using ll = long long; using P = pair<int, int>; template <typename T> void chmin(T &a, T b) { a = min(a, b); } template <typename T> void chmax(T &a, T b) { a = max(a, b)...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
200
import math a,b,H,M = list(map(int,input().split())) angle=abs((H*30+M/2)-M*6)/360*2*math.pi print(angle) print((a**2+b**2-2*a*b*math.cos(angle))**0.5)
import math a,b,H,M = list(map(int,input().split())) angle=abs((H*30+M/2)-M*6)/360*2*math.pi print((a**2+b**2-2*a*b*math.cos(angle))**0.5)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24]]
5
82
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ll long long #define MOD 1000000007 #define MAX 100010 #define aout(a) \ REP(i, sizeof(a)) cout << a[i] << " "; ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ll long long #define MOD 1000000007 #define MAX 100010 #define aout(a) \ REP(i, sizeof(a)) cout << a[i] << " "; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 43, 49, 50, 51, 2, 63, 22], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 24], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 25]]
1
182
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; #define endl '\n' template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename...
#include <bits/stdc++.h> using namespace std; using ll = long long; constexpr ll mod = 1e9 + 7; #define endl '\n' template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 31, 22], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 31, 16, 12, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25]]
1
867
A,B,H,M=map(int, input().split()) angle = abs(30*H-5.5*M) angle = min(angle, 360-angle)*math.pi/180 c=A**2 + B**2 -2*A*B* math.cos(angle) c=c**0.5 print(c)
A,B,H,M=map(int, input().split()) import math angle = abs(30*H-5.5*M) angle = min(angle, 360-angle)*math.pi/180 c=A**2 + B**2 -2*A*B* math.cos(angle) c=c**0.5 print(c)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
79
import math a, b, h, m = map(int, input().split()) alpha = 30.0 * h + m / 60 beta = m * 60.0 if alpha < beta: theta = beta - alpha else: theta = alpha - beta print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta))))
import math a, b, h, m = map(int, input().split()) alpha = 30.0 * h + (30 * m / 60) beta = m * 6.0 if alpha < beta: theta = beta - alpha else: theta = alpha - beta print(math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(math.radians(theta))))
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 31, 612], ["+", 12, 657, 12, 23, 0, 657, 31, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 531], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 531]]
5
86
A, B, H, M = map(int, input().split()) import math theta = (30 * H) - (0.5 * M) d2 = A * A + B * B - 2 * A * B * math.cos(math.radians(theta)) d = math.sqrt(d2) print(d)
A, B, H, M = map(int, input().split()) import math theta = (30 * H) - (5.5 * M) d2 = A * A + B * B - 2 * A * B * math.cos(math.radians(theta)) d = math.sqrt(d2) print(d)
[["-", 0, 662, 12, 657, 12, 23, 0, 657, 31, 531], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 31, 531]]
5
74
#include <bits/stdc++.h> using namespace std; typedef long long lol; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (lol i = 0; i < lol(n); i++) #define REPD(i, n) for (lol i = n - 1; i >= 0; i--) #define FOR(i, a, b) fo...
#include <bits/stdc++.h> using namespace std; typedef long long lol; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (lol i = 0; i < lol(n); i++) #define REPD(i, n) for (lol i = n - 1; i >= 0; i--) #define FOR(i, a, b) fo...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
278
#include <bits/stdc++.h> using namespace std; using ll = long long; #define INT(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define LL(...) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define INT(...) \ int __VA_ARGS__; \ in(__VA_ARGS__) #define LL(...) ...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]]
1
1,076
from sys import stdin import sys, math a, b, h, m = [int(x) for x in stdin.readline().rstrip().split()] x = 30*h + 0.5*m y = 6*m z = abs(x-y) if z > 180: z = z-180 c = a**2 + b**2 - 2*a*b*math.cos(math.radians(z)) c = math.sqrt(c) print(c)
from sys import stdin import sys, math a, b, h, m = [int(x) for x in stdin.readline().rstrip().split()] x = 30*h + 0.5*m y = 6*m z = abs(x-y) if z > 180: z = 360 - z c = a**2 + b**2 - 2*a*b*math.cos(math.radians(z)) c = math.sqrt(c) print(c)
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
109
import math A , B , H , M = map(int,input().split()) Hour_rad = H * 30 Hour_rad += M * 0.5 Min_rad = M * 6 rad = abs(Hour_rad - Min_rad) #Hour_redとMin_radが180度離れていたらコサインに1引いたものを代入する。 if rad > 180: rad -= 180 ans = A**2 + B**2 - ( 2 * A * B * math.cos( math.radians ( rad )) ) ans = math.sqrt(ans) print(ans)
import math A , B , H , M = map(int,input().split()) Hour_rad = H * 30 Hour_rad += M * 0.5 Min_rad = M * 6 rad = abs(Hour_rad - Min_rad) if rad > 180: rad = 360 - rad #Hour_redとMin_radが180度離れていたらコサインに1引いたものを代入する。 ans = A**2 + B**2 - ( 2 * A * B * math.cos( math.radians ( rad )) ) ans = math.sqrt(ans) p...
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["-", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
95
import math a,b,h,m = map(int,input().split()) th = m / 60 - (m + 60*h) / 720 pi = math.pi print(th) print(math.sqrt(a**2 + b ** 2 - 2 * a * b * math.cos(2*pi*th)))
import math a,b,h,m = map(int,input().split()) th = m / 60 - (m + 60*h) / 720 pi = math.pi print(math.sqrt(a**2 + b ** 2 - 2 * a * b * math.cos(2*pi*th)))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
78
#include <math.h> #include <stdio.h> #define PI 3.141592653589793238 int main() { int A, B, H, M; scanf("%d%d%d%d", &A, &B, &H, &M); long double ans; ans = cos(2 * PI * (H / 12.0 + (M / (60.0 * 12.0)) - M / 60.0)); printf("%Lf\n", sqrt(A * A + B * B - 2 * A * B * ans)); return 0; }
#include <math.h> #include <stdio.h> #define PI 3.141592653589793238 int main() { int A, B, H, M; scanf("%d%d%d%d", &A, &B, &H, &M); long double ans; ans = cos(2 * PI * (H / 12.0 + (M / (60.0 * 12.0)) - M / 60.0)); printf("%.20lf\n", sqrt(A * A + B * B - 2 * A * B * ans)); return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
104
import math a,b,h,m = map(int,input().split()) def clock_to_minutes(h, m): minutes = m minutes += h*60 return minutes angular_speed_A = 360/12/60 angular_speed_B = 6 angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360) ans = sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle))) print...
import math a,b,h,m = map(int,input().split()) def clock_to_minutes(h, m): minutes = m minutes += h*60 return minutes angular_speed_A = 360/12/60 angular_speed_B = 6 angle = abs((angular_speed_A - angular_speed_B)*clock_to_minutes(h,m)%360) ans = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(math.radians(angle))) ...
[["+", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131]]
5
103
#include <math.h> #include <stdio.h> #define PI 3.14159265 int main(void) { int A, B, H, M; double ans; scanf("%d%d%d%d", &A, &B, &H, &M); ans = cos(2 * PI * (H / 12.0 + (M / (60.0 * 12.0)) - M / 60.0)); printf("%lf\n", sqrt(A * A + B * B - 2 * A * B * ans)); }
#include <math.h> #include <stdio.h> #define PI 3.14159265358979323846264338327950L int main(void) { int A, B, H, M; double ans; scanf("%d%d%d%d", &A, &B, &H, &M); ans = cos(2 * PI * (H / 12.0 + (M / (60.0 * 12.0)) - M / 60.0)); printf("%.20lf\n", sqrt(A * A + B * B - 2 * A * B * ans)); }
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
101
#include <math.h> #include <stdio.h> #define PI 3.14159265358979323846264338327950L int main() { int a, b, h, m; long double rad, length; scanf("%d%d%d%d", &a, &b, &h, &m); rad = 2.0 * PI * ((long double)h / 12.0 + (long double)m / 60.0 / 12.0 - (long double)m / 60.0); length = sqrtl((long ...
#include <math.h> #include <stdio.h> #define PI 3.14159265358979323846264338327950L int main() { int a, b, h, m; long double rad, length; scanf("%d%d%d%d", &a, &b, &h, &m); rad = 2.0 * PI * ((long double)h / 12.0 + (long double)m / 60.0 / 12.0 - (long double)m / 60.0); length = sqrtl((long ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
129
import math A, B, H, M = map(int, input().split()) H_angle = 30*H M_angle = 6*M angle = abs(H_angle-M_angle) angle = min(angle, 360-angle) ans = (A*A+B*B-2*A*B*math.cos(math.radians(angle)))**0.5 print(ans)
import math A, B, H, M = map(int, input().split()) H_angle = 30*H+0.5*M M_angle = 6*M angle = abs(H_angle-M_angle) angle = min(angle, 360-angle) ans = (A*A+B*B-2*A*B*math.cos(math.radians(angle)))**0.5 print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 31, 531], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 22]]
5
85
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower) using namespace std; using ll = long long; int INF = 1001001001; int main() { int a, b, h, m; cin >> a >> b >> h >> m; double pi = acos(-1); double ans = sqrt(a * ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower) using namespace std; using ll = long long; int INF = 1001001001; int main() { int a, b, h, m; cin >> a >> b >> h >> m; double pi = acos(-1); double ans = sqrt(a * ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
113
#include <math.h> #include <stdio.h> #include <stdlib.h> #define rep(i, n) for (i = 0; i < n; i++) #define PI 3.14159265358979323846264338327950L int main() { int a, b, h, m; scanf("%d%d%d%d", &a, &b, &h, &m); long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) - (long double)m...
#include <math.h> #include <stdio.h> #include <stdlib.h> #define rep(i, n) for (i = 0; i < n; i++) #define PI 3.14159265358979323846264338327950L int main() { int a, b, h, m; scanf("%d%d%d%d", &a, &b, &h, &m); long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 -...
[["+", 12, 23, 0, 16, 31, 16, 12, 16, 17, 85], ["+", 12, 23, 0, 16, 31, 16, 12, 16, 12, 13]]
0
131
import math A, B, H, M = map(int, input().split()) angle = 30*H-6*M if angle > 180: angle = 360 - angle print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(angle)))))
import math A, B, H, M = map(int, input().split()) angle = (30*H + M/2) - 6*M if angle > 180: angle = 360 - angle print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(angle)))))
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 72], ["+", 12, 657, 31, 23, 0, 657, 12, 657, 31, 22], ["+", 12, 657, 31, 23, 0, 657, 12, 657, 17, 85], ["+", 12, 657, 31, 23, 0, 657, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
77
import math a,b,h,m = map(int,input().split()) hl = h * 30 + 30 * (m / 60) ml = m * 60 if ml == 0: c = 360 - hl else: c = abs(hl - ml) if c > 180: c = 360 - c d = (a ** 2) + (b ** 2) - (2 * a * b * (math.cos(math.radians(c)))) print(math.sqrt(d))
import math a,b,h,m = map(int,input().split()) hl = h * 30 + 30 * (m / 60) ml = m * 6 if ml == 0: c = 360 - hl else: c = abs(hl - ml) if c > 180: c = 360 - c d = (a ** 2) + (b ** 2) - (2 * a * b * (math.cos(math.radians(c)))) print(math.sqrt(d))
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
114
import numpy as np A, B, H, M = map(int, input().split()) Aw = 2 * np.pi / 12 / 60 Bw = 2 * np.pi / 60 thetaA = Aw * (H * 60 + M) thetaB = Bw * M # thetaA = 2 * np.pi * H / 12 + 2 * np.pi / 12 * M / 60 # thetaB = 2 * np.pi * M / 60 if thetaA > thetaB: ans = np.sqrt(A ** 2 + B ** 2 - 2 * A * B * np.cos(thetaA - t...
import numpy as np A, B, H, M = map(int, input().split()) Aw = 2 * np.pi / 12 / 60 Bw = 2 * np.pi / 60 thetaA = Aw * (H * 60 + M) thetaB = Bw * M # thetaA = 2 * np.pi * H / 12 + 2 * np.pi / 12 * M / 60 # thetaB = 2 * np.pi * M / 60 if thetaA > thetaB: ans = np.sqrt(A ** 2 + B ** 2 - 2 * A * B * np.cos(thetaA - t...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
141
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) using namespace std; typedef long long ll; long double A, B, H, M; long double angle; int main() { cin >> A >> B >> H >> M; angle = (30 * H) + (30 * ...
#include <bits/stdc++.h> #define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++) using namespace std; typedef long long ll; long double A, B, H, M; long double angle; int main() { cin >> A >> B >> H >> M; angle = (30 * H) + (30 * ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13]]
1
154
# 余弦定理から、a**2 = b**2 + c**2 - 2bccosA # ヨビノリの授業動画で三角関数の理解を深める # import math # a,b,h,m = map(int,input().split()) # q = abs((h+m/60)/12-m/60) * 360 # print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(q)))) import math A, B, H, M = map(int, input().split()) ''' 時計の角度はいくつか? 長針は60分で1回展(360度)回るので1分あたりに進む角度は、 360 /...
# 余弦定理から、a**2 = b**2 + c**2 - 2bccosA # ヨビノリの授業動画で三角関数の理解を深める # import math # a,b,h,m = map(int,input().split()) # q = abs((h+m/60)/12-m/60) * 360 # print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(q)))) import math A, B, H, M = map(int, input().split()) ''' 時計の角度はいくつか? 長針は60分で1回展(360度)回るので1分あたりに進む角度は、 360 /...
[["+", 12, 652, 3, 4, 0, 652, 63, 319, 500, 22], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 12, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
86
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int A, B, H, M; //時針Acm 分針Bcm H時M分 double Arad; // 12時からの時針の角度 double Brad; // 12時からの分針の角度 double ABrad; //時針と分針の間の角度 double C; //求める長さ scanf("%d %d %d %d", &A, &B, &H, &M); Arad = 360 * (double)H / ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int A, B, H, M; //時針Acm 分針Bcm H時M分 double Arad; // 12時からの時針の角度 double Brad; // 12時からの分針の角度 double ABrad; //時針と分針の間の角度 double C; //求める長さ scanf("%d %d %d %d", &A, &B, &H, &M); Arad = 360 * (double)H / ...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
152
#https://atcoder.jp/contests/abc168 a,b,h,m=gets.split(" ") a,b,h,m=[a,b,h,m].map{|n| n.to_f} #A時針12時間一周=一時間2/12π進行 #B分針一時間一周=一時間2π進行 #a=3.0;b=4.0;m=0.0;h=9.0#.0つけろ sitaA=(h+m/60)*2/12*Math::PI sitaB=(h+m/60)*2*Math::PI p sitaA,sitaB #x^2=a^2+b^2-2ab cos sita p Math.sqrt(a**2+b**2-2*a*b*Math.cos(sitaA-sitaB) )
#https://atcoder.jp/contests/abc168 a,b,h,m=gets.split(" ") a,b,h,m=[a,b,h,m].map{|n| n.to_f} #A時針12時間一周=一時間2/12π進行 #B分針一時間一周=一時間2π進行 #a=3.0;b=4.0;m=0.0;h=9.0#.0つけろ sitaA=(h+m/60)*2/12*Math::PI sitaB=(h+m/60)*2*Math::PI #p sitaA,sitaB #x^2=a^2+b^2-2ab cos sita p Math.sqrt(a**2+b**2-2*a*b*Math.cos(sitaA-sitaB) )
[["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 21], ["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22]]
4
112
import math # A = int(input()) # B = int(input()) # H = int(input()) # M = int(input()) A, B, H, M = map(int, input().split()) def angle(): wa = 0.5 wb = 6 w = wb-wa t = H*60 + M wnew = (w*t)%360 if wnew>=180: wnew = 360 - wnew return wnew cos_angle = math.cos(math.radians(angle())) distance = A**2 ...
import math A, B, H, M = map(int, input().split()) def angle(): wa = 0.5 wb = 6 w = wb-wa t = H*60 + M wnew = (w*t)%360 if wnew>=180: wnew = 360 - wnew return wnew cos_angle = math.cos(math.radians(angle())) distance = A**2 + B**2 - 2*A*B*cos_angle answer = distance**0.5 print(answer)
[["-", 0, 662, 12, 657, 31, 657, 12, 657, 31, 22], ["+", 0, 662, 12, 657, 31, 657, 12, 657, 31, 22]]
5
111
import math a,b,h,m = map(int,input().split()) a_S = (30*h)%360+0.5*m b_s = (6*m) s = max(a_s,b_s)-min(a_s,b_s) ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s))) print(ans)
import math a,b,h,m = map(int,input().split()) a_s = (30*h)%360+0.5*m b_s = (6*m) s = max(a_s,b_s)-min(a_s,b_s) ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s))) print(ans)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
93
// Problem : C - : (Colon) // Contest : AtCoder - AtCoder Beginner Contest 168 // URL : https://atcoder.jp/contests/abc168/tasks/abc168_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define PI 3.141592653...
// Problem : C - : (Colon) // Contest : AtCoder - AtCoder Beginner Contest 168 // URL : https://atcoder.jp/contests/abc168/tasks/abc168_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cpeditor) #include <bits/stdc++.h> using namespace std; #define PI 3.141592653...
[["-", 0, 57, 64, 1, 0, 11, 12, 16, 31, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["-", 0, 57, 64, 1, 0, 11, 12, 16, 12, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
159
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll inf = 1e9 + 7; #define pi 3.14159265358979323846L bool isprime(ll a) { ll cnt = 0; for (ll i = 1; i * i < a; i++) { if (a % i == 0) { cnt += 2; } } if (cnt == 2) return true; else return false; } ll mod(ll a) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll inf = 1e9 + 7; #define pi 3.14159265358979323846L bool isprime(ll a) { ll cnt = 0; for (ll i = 1; i * i < a; i++) { if (a % i == 0) { cnt += 2; } } if (cnt == 2) return true; else return false; } ll mod(ll a) { ...
[["+", 0, 1, 0, 16, 31, 16, 12, 2, 63, 22], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 24], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 25], ["+", 0, 14, 8, 9, 0, 1, 0, 16, 17, 151]]
1
255
#include <bits/stdc++.h> using namespace std; int main() { static const double pi = 3.141592653589793; double A, B, H, M; cin >> A >> B >> H >> M; double theta, phi; theta = 2.0 * pi * (60.0 * H + M) / (12.0 * 60.0); phi = 2.0 * pi * M / 60.0; double diff = abs(theta - phi); if (diff > pi) diff -...
#include <bits/stdc++.h> using namespace std; int main() { static const double pi = 3.141592653589793; double A, B, H, M; cin >> A >> B >> H >> M; double theta, phi; theta = 2.0 * pi * (60.0 * H + M) / (12.0 * 60.0); phi = 2.0 * pi * M / 60.0; double diff = abs(theta - phi); if (diff > pi) diff ...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 31, 13], ["+", 64, 1, 0, 11, 12, 16, 31, 16, 17, 48], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
131
import numpy as np a, b, h, m = map(int, input().split()) theta = np.abs((h * 5 / 60 - m / 60) * 2 * np.pi) theta = min(theta, 2 * np.pi - theta) d = np.sqrt(a ** 2 + b ** 2 - 2 * a * b * np.cos(theta)) print(d)
import numpy as np a, b, h, m = map(int, input().split()) theta = np.abs(((h+m/60) * 5 / 60 - m / 60) * 2 * np.pi) theta = min(theta, 2 * np.pi - theta) d = np.sqrt(a ** 2 + b ** 2 - 2 * a * b * np.cos(theta)) print(d)
[["+", 0, 657, 31, 657, 31, 657, 31, 23, 0, 24], ["+", 31, 657, 31, 657, 31, 23, 0, 657, 17, 72], ["+", 31, 657, 31, 23, 0, 657, 12, 657, 31, 22], ["+", 31, 657, 31, 23, 0, 657, 12, 657, 17, 85], ["+", 31, 657, 31, 23, 0, 657, 12, 657, 12, 612], ["+", 0, 657, 31, 657, 31, 657, 31, 23, 0, 25]]
5
93
#include <bits/stdc++.h> #define PI acos(-1) using namespace std; int main() { double ans, rad, deg, A, B; double H, M; cin >> A >> B >> H >> M; H = 30 * H + 0.5 * M; M *= 6; if (H > M) { deg = H - M; } else { deg = M - H; } rad = cos((rad * PI) / 180.0); ans = A * A + B * B - rad * 2 * A *...
#include <bits/stdc++.h> #define PI acos(-1) using namespace std; int main() { double ans, rad, deg, A, B; double H, M; cin >> A >> B >> H >> M; H = 30 * H + 0.5 * M; M *= 6; if (H > M) { deg = H - M; } else { deg = M - H; } rad = cos((deg * PI) / 180.0); ans = A * A + B * B - rad * 2 * A ...
[["-", 3, 4, 0, 16, 31, 23, 0, 16, 31, 22], ["+", 3, 4, 0, 16, 31, 23, 0, 16, 31, 22], ["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
126
import math pi = math.pi a = input() a = a.split() A = float(a[0]) B = float(a[1]) H = float(a[2]) M = float(a[3]) Ab = H*5 + 5/60*M Ar = 2*pi * Ab / 60 Br = 2*pi * M / 60 if Ar > Br: Cr = Ar - Br else: Cr = Br - Ar if Cr > pi: Cr -= pi ans = A**2 + B**2 - 2*A*B*math.cos(Cr) print(math.sqrt(ans))
import math pi = math.pi a = input() a = a.split() A = float(a[0]) B = float(a[1]) H = float(a[2]) M = float(a[3]) Ab = H*5 + 5/60*M Ar = 2*pi * Ab / 60 Br = 2*pi * M / 60 if Ar > Br: Cr = Ar - Br else: Cr = Br - Ar if Cr > pi: Cr = 2*pi - Cr ans = A**2 + B**2 - 2*A*B*math.cos(Cr) print(math.sqrt(ans))
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 110], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 31, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
140
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { static const double pi = 3.141592653589793; int a, b, h, m; cin >> a >> b >> h >> m; double rad = pi * 2 * ((double)h / 12.0 + ((double)m / 60.0) / 12.0 - (double)m / 60.0); double pow = (double)(a * a + b * b...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { static const double pi = 3.141592653589793; int a, b, h, m; cin >> a >> b >> h >> m; double rad = pi * 2 * ((double)h / 12.0 + ((double)m / 60.0) / 12.0 - (double)m / 60.0); double pow = (double)(a * a + b * b...
[["-", 49, 50, 51, 16, 12, 16, 12, 2, 63, 22], ["-", 51, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 51, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["+", 12, 16, 12, 2, 3, 4, 0, 2, 63, 22]]
1
127
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { static const double pi = 3.141592653589793; int a, b, h, m; cin >> a >> b >> h >> m; double rad = pi * 2 * ((double)h / 12.0 + ((double)m / 60.0) / 12.0 - (double)m / 60.0); double pow = (double)(a * a + b * b...
#include <bits/stdc++.h> using namespace std; using ll = long long int; int main() { static const double pi = 3.141592653589793; int a, b, h, m; cin >> a >> b >> h >> m; double rad = pi * 2 * ((double)h / 12.0 + ((double)m / 60.0) / 12.0 - (double)m / 60.0); double pow = (double)(a * a + b * b...
[["-", 49, 50, 51, 16, 12, 16, 12, 2, 63, 22], ["-", 51, 16, 12, 16, 12, 2, 3, 4, 0, 24], ["-", 12, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
127
a,b,h,m = gets.chomp.split.map(&:to_i) ans = 0 h = 0 if h == 12 kakudo = 30*h + (m/2).to_f - 6*m kakudo = kakudo.abs if kakudo == 180 ans = a + b else if kakudo > 180 kakudo = 360 - kakudo end end c = (a**2) + (b**2) - 2*a*b * Math.cos( kakudo * Math::PI / 180 ) ans = Math.sqrt(c) puts ans
a,b,h,m = gets.chomp.split.map(&:to_i) ans = 0 h = 0 if h == 12 kakudo = 30*h + (m.to_f/2) - 6*m kakudo = kakudo.abs if kakudo == 180 ans = a + b else if kakudo > 180 kakudo = 360 - kakudo end end #puts kakudo c = (a**2) + (b**2) - 2*a*b * Math.cos( kakudo * Math::PI / 180 ) ans = Math.sqrt(c) puts ans
[["+", 31, 738, 12, 739, 0, 738, 31, 652, 17, 131], ["+", 31, 738, 12, 739, 0, 738, 31, 652, 735, 22], ["-", 0, 662, 12, 738, 31, 738, 12, 652, 17, 131], ["-", 0, 662, 12, 738, 31, 738, 12, 652, 735, 22]]
4
114
import math #from decimal import Decimal A,B,H,M = map(int,input().split()) Hd = 2*math.pi*H/12 + 5/360*2*math.pi*M/60 Md = 2*math.pi*M/60 Hx = A*math.cos(Hd) Hy = A*math.sin(Hd) Mx = B*math.cos(Md) My = B*math.sin(Md) r = ((Hx - Mx)**2 + (Hy - My)**2)**0.5 print(r)
import math #from decimal import Decimal A,B,H,M = map(int,input().split()) Hd = 2*math.pi*H/12 + 30/360*2*math.pi*M/60 Md = 2*math.pi*M/60 Hx = A*math.cos(Hd) Hy = A*math.sin(Hd) Mx = B*math.cos(Md) My = B*math.sin(Md) r = ((Hx - Mx)**2 + (Hy - My)**2)**0.5 print(r)
[["-", 31, 657, 31, 657, 31, 657, 31, 657, 31, 612], ["+", 31, 657, 31, 657, 31, 657, 31, 657, 31, 612]]
5
124
#include <math.h> #include <stdio.h> int main() { double a, b, h, m, deg, ans; scanf("%lf %lf %lf %lf", &a, &b, &h, &m); // c2=a2+b2−2ab*cos𝐶 deg = fabs((11 * m - 60 * h) * M_PI / 360); ans = sqrt(a * a + b * b - 2 * a * b * cos(deg)); printf("%lf", ans); return (0); }
#include <math.h> #include <stdio.h> int main() { double a, b, h, m, deg, ans; scanf("%lf %lf %lf %lf", &a, &b, &h, &m); // c2=a2+b2−2ab*cos𝐶 deg = fabs((11 * m - 60 * h) * M_PI / 360); ans = sqrt(a * a + b * b - 2 * a * b * cos(deg)); printf("%.16lf", ans); return (0); }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
100
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { int a, b, h, m; cin >> a >> b >> h >> m; double ha = (h * 30 + 30 * m / 60) * 2 * M_PI / 360; double ma = m * 6 * 2 * M_PI / 360; double angle = max(abs(ha - ma), 2 * M_PI - a...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; int main() { double a, b, h, m; cin >> a >> b >> h >> m; double ha = (h * 30 + 30 * m / 60) * 2 * M_PI / 360; double ma = m * 6 * 2 * M_PI / 360; double angle = max(abs(ha - ma), 2 * M_PI ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
147
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; const double PI = acos(-1.0); int main() { int a, b, h, m; cin >> a >> b >> h >> m; double ha = (h * 60 + m) / 720 * (PI * 2); double ma = m / 60 * (PI * 2); double angle = ha - ma; dou...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) using ll = long long; const double PI = acos(-1.0); int main() { double a, b, h, m; cin >> a >> b >> h >> m; double ha = (h * 60 + m) / 720 * (PI * 2); double ma = m / 60 * (PI * 2); double angle = ha - ma; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 0, 16, 12, 16, 31, 16, 31, 16, 31, 13]]
1
131
#include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int a, b, h, m; cin >> a >> b >> h >> m; long double rad, rad_a, rad_b; rad_a = h * 30 + m * 0.5; rad_b = m * 6; rad = abs(rad_a - rad_b); if (rad > 180) rad -= 180; rad = M_PI * ...
#include <bits/stdc++.h> #include <cmath> #include <iomanip> #include <iostream> using namespace std; int main(void) { int a, b, h, m; cin >> a >> b >> h >> m; long double rad, rad_a, rad_b; rad_a = h * 30 + m * 0.5; rad_b = m * 6; rad = abs(rad_a - rad_b); if (rad > 180) rad = 360 - rad; rad = M_...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
141
#include <bits/stdc++.h> using namespace std; int main() { int a, b, h, m; double result, h_degrees, m_degrees; cin >> a >> b >> h >> m; m_degrees = (m / 60.0) * 360.0; h_degrees = (h / 12.0) * 360 + (m / 60.0) * 30; result = a * a + b * b - 2 * a * b * cos(abs(m_degrees - h_degrees) * (M_PI...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, h, m; double result, h_degrees, m_degrees; cin >> a >> b >> h >> m; m_degrees = (m / 60.0) * 360.0; h_degrees = (h / 12.0) * 360 + (m / 60.0) * 30; result = a * a + b * b - 2 * a * b * cos(abs(m_degrees - h_degrees) * (M_PI...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
115
#include <bits/stdc++.h> #define PI 3.141592653589793238 using namespace std; int main() { int a, b; cin >> a >> b; int h, m; cin >> h >> m; int angle_minute_hand = 6 * m; int angle_hour_hand = 30 * h + 0.5 * m; int angle = max(angle_minute_hand, angle_hour_hand) - min(angle_minute_hand, an...
#include <bits/stdc++.h> #define PI 3.141592653589793238 using namespace std; int main() { int a, b; cin >> a >> b; int h, m; cin >> h >> m; double angle_minute_hand = 6 * m; double angle_hour_hand = 30 * h + 0.5 * m; double angle = max(angle_minute_hand, angle_hour_hand) - min(angle_min...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
181
a,b,h,m = map(int, input().split()) import math (a**2+b**2-2*a*b*math.cos(math.radians((360*h/12+30*m/60)-360*m/60)))**(1/2)
a,b,h,m = map(int, input().split()) import math print((a**2+b**2-2*a*b*math.cos(math.radians((360*h/12+30*m/60)-360*m/60)))**(1/2))
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["+", 0, 652, 3, 4, 0, 657, 12, 23, 0, 25]]
5
73
A, B, H, M = map(int,input().split()) import math x = H / 12 * 360 y = M / 60 * 360 ang = abs(y - x) ans_2 = A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(ang)) ans = math.sqrt(ans_2) print(ans)
A, B, H, M = map(int,input().split()) import math x = H / 12 * 360 + M / 60 * 30 y = M / 60 * 360 ang = abs(y - x) ans_2 = A ** 2 + B ** 2 - 2 * A * B * math.cos(math.radians(ang)) ans = math.sqrt(ans_2) print(ans)
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 657, 31, 657, 31, 22], ["+", 0, 662, 12, 657, 12, 657, 31, 657, 17, 85], ["+", 0, 662, 12, 657, 12, 657, 31, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612]]
5
83
import math a, b, h, m = map(int, input().split()) ang = abs(h * 30 - m * 11/2) angle = min(ang, 360-ang) print(angle) c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(angle))) print(c)
import math a, b, h, m = map(int, input().split()) ang = abs(h * 30 - m * 11/2) angle = min(ang, 360-ang) c = math.sqrt(a ** 2 + b ** 2 - 2 * a * b * math.cos(math.radians(angle))) print(c)
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
86
#include <bits/stdc++.h> using namespace std; signed main() { const double PI = acos(-1); double A, B; int H, M; scanf("%lf%lf", &A, &B); scanf("%d%d", &H, &M); double x = (H * 360 / 12 + M * 360 / 12 / 60) * PI / 180; double y = (M * 360 / 60) * PI / 180; printf("%.20lf\n", sqrt(A * A + B * B - 2 * A ...
#include <bits/stdc++.h> using namespace std; signed main() { const double PI = acos(-1); double A, B; double H, M; scanf("%lf%lf", &A, &B); scanf("%lf%lf", &H, &M); double x = (H * 360 / 12 + M * 360 / 12 / 60) * PI / 180; double y = (M * 360 / 60) * PI / 180; printf("%.20lf\n", sqrt(A * A + B * B - 2...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
130
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define INF 0x6fffffff #define INFL 0x6fffffffffffffffLL int main() { ll a, b, c, i, j, k, n, h, m, x, y; string s; cin >> a >> b >> h >> m; double hh, mm, deg, ans; hh = double(h * 60 + m) / 2.0; mm = m * 6; d...
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; using ll = long long; #define INF 0x6fffffff #define INFL 0x6fffffffffffffffLL int main() { ll a, b, c, i, j, k, n, h, m, x, y; string s; cin >> a >> b >> h >> m; double hh, mm, deg, ans; hh = double(h * 60 + m) / 2.0; mm = m * 6; d...
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 17, 110], ["-", 8, 9, 0, 57, 64, 1, 0, 11, 12, 13], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 31, 13], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 17, 33], ["+", 0, 57, 64, 1, 0, 11, 12, 16, 12, 22]]
1
163
import math A, B, H, M = map(int, input().split()) print((A**2+B**2-2*B*math.cos(math.radians(abs((H*60+M)/2-M*6))))**0.5)
import math A, B, H, M = map(int, input().split()) print((A**2+B**2-2*A*B*math.cos(math.radians(abs((H*60+M)/2-M*6))))**0.5)
[["+", 0, 657, 12, 657, 31, 657, 31, 657, 12, 22], ["+", 31, 23, 0, 657, 12, 657, 31, 657, 17, 48]]
5
67
#include <bits/stdc++.h> using namespace std; int main() { int A, B, H, M; long double ans; cin >> A >> B >> H >> M; long double A_deg, B_deg; A_deg = 30 * H + (0.5 * M); B_deg = 6 * M; long double deg = abs((A_deg - B_deg)); long double cdeg = abs(deg * M_PI / 180.0); ans = sqrtl((long double)(A * A...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, H, M; long double ans; cin >> A >> B >> H >> M; long double A_deg, B_deg; A_deg = 30 * H + (0.5 * M); B_deg = 6 * M; long double deg = abs((A_deg - B_deg)); long double cdeg = abs(deg * M_PI / 180.0); ans = sqrtl((long double)(A * A...
[["-", 51, 23, 0, 16, 12, 23, 0, 2, 63, 22], ["-", 0, 16, 12, 23, 0, 2, 3, 4, 0, 24], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
1
142
A, B, H, M = map(int, input().split()) sitaH = (H*60+M) / 720 * 2 * math.pi sitaM = M/60 * 2 * math.pi posXH = A * math.cos(sitaH) posYH = A * math.sin(sitaH) posXM = B * math.cos(sitaM) posYM = B * math.sin(sitaM) delX = posXH - posXM delY = posYH - posYM d = (delX*delX + delY*delY)**(1/2) print(d)
import math A, B, H, M = map(int, input().split()) sitaH = (H*60+M) / 720 * 2 * math.pi sitaM = M/60 * 2 * math.pi posXH = A * math.cos(sitaH) posYH = A * math.sin(sitaH) posXM = B * math.cos(sitaM) posYM = B * math.sin(sitaM) delX = posXH - posXM delY = posYH - posYM d = (delX*delX + delY*delY)**(1/2) print(d)
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
119
import math A,B,H,M = map(int,input().split()) V1 = 30 V2 = 30/60 v = 6 d = abs( (V1*H + V2*M) - v*M) if d == 0: print(0) else: print(math.sqrt(A**2 + B**2 -2*A*B*math.cos(math.radians(d))))
import math A,B,H,M = map(int,input().split()) V1 = 30 V2 = 30/60 v = 6 d = abs( (V1*H + V2*M) - v*M) if d == 0: print(abs(A-B)) else: print(math.sqrt(A**2 + B**2 -2*A*B*math.cos(math.radians(d))))
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 31, 22], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 33], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
95
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
#include <bits/stdc++.h> using namespace std; #define DBG(x) \ (void)(cout << "L" << __LINE__ << ": " << #x << " = " << (x) << '\n') #define Lower_bound(v, x) \ distance(v.begin(), lower_bound(v.beg...
[["-", 0, 14, 8, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
1
263
#include <bits/stdc++.h> #include <math.h> using namespace std; using ll = long long; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; double e, f; e = (30 * c - 6 * d) * M_PI / 180; f = a * a + b * b - 2 * a * b * cos(e); double g = sqrt(f); cout << fixed << setprecision(16); cout << g << endl; }
#include <bits/stdc++.h> #include <math.h> using namespace std; using ll = long long; int main() { ll a, b, c, d; cin >> a >> b >> c >> d; double e, f; e = (30 * c - 5.5 * d) * M_PI / 180; f = a * a + b * b - 2 * a * b * cos(e); double g = sqrt(f); cout << fixed << setprecision(16); cout << g << endl; }
[["-", 31, 16, 31, 23, 0, 16, 12, 16, 31, 13], ["+", 31, 16, 31, 23, 0, 16, 12, 16, 31, 13]]
1
104
a, b, h, m = map(int,input().split()) angle = 30*h - 5.5*m if angle == 0: print(b-a) exit() import math ans = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))**0.5 print(ans)
a, b, h, m = map(int,input().split()) angle = 30*h - 5.5*m if angle == 0: print(abs(b-a)) exit() import math ans = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))**0.5 print(ans)
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
80
a, b, h, m = map(int,input().split()) angle = 30*h + 5.5*m import math ans = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))**0.5 print(ans)
a, b, h, m = map(int,input().split()) angle = 30*h - 5.5*m import math ans = (a*a + b*b - 2*a*b*math.cos(math.radians(angle)))**0.5 print(ans)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 33]]
5
66
from math import cos, radians, sqrt a, b, h, m = map(int, input().split()) angle = radians(h*30 + m / 2- m*6) print(angle) print(sqrt(a**2 + b**2 - 2*a*b*cos(angle)))
from math import cos, radians, sqrt a, b, h, m = map(int, input().split()) angle = radians(h*30 + m / 2- m*6) print(sqrt(a**2 + b**2 - 2*a*b*cos(angle)))
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
72
import math A, B, H, M =map(int, input().split()) Hs = H*30 + M/2 Ms = 6*M shita = Hs-Ms shita = abs(shita) if shita >= 180: shita = shita - 180 shita = math.radians(shita) C = A*A + B*B - 2*A*B*(math.cos(shita)) print (math.sqrt(C))
import math A, B, H, M =map(int, input().split()) Hs = H*30 + M*0.5 Ms = 6*M shita = Hs-Ms shita = abs(shita) if shita >= 180: shita = 360 - shita shita = math.radians(shita) C = A*A + B*B - 2*A*B*(math.cos(shita)) print (math.sqrt(C))
[["-", 0, 1, 0, 662, 12, 657, 12, 657, 17, 85], ["-", 0, 1, 0, 662, 12, 657, 12, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 531], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 31, 612], ["-", 64, 196, 0, 1, 0, 662, 12, 6...
5
98
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; int main() { ios::sync_with_stdio(false); double a, b, h, m, c; cin >> a >> b >> h >> m; h = h * 30...
#include <algorithm> #include <cmath> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> pii; const int mod = 1000000007; int main() { ios::sync_with_stdio(false); double a, b, h, m, c; cin >> a >> b >> h >> m; h = h * 30...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
142
import math A, B, H, M = map(int, input().split(' ')) deg = abs((6 * M - (30 * H + 0.5 * M))) % 180 if deg > 180: deg = 360 - deg deg = math.radians(deg) print(math.sqrt((B - A * math.cos(deg)) ** 2 + (A * math.sin(deg)) ** 2))
import math A, B, H, M = map(int, input().split(' ')) deg = abs((6 * M - (30 * H + 0.5 * M))) if deg > 180: deg = 360 - deg deg = math.radians(deg) print(math.sqrt((B - A * math.cos(deg)) ** 2 + (A * math.sin(deg)) ** 2))
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 109], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
100
import math a, b, h, m = map(int, input().split()) hrad, mrad = math.pi*(60*h+m)/360, math.pi * m / 30 rad = min(abs(hrad - mrad), math.pi - abs(hrad - mrad)) print((a ** 2 + b ** 2 - 2 * a * b * math.cos(rad))** 0.5)
import math a, b, h, m = map(int, input().split()) hrad, mrad = math.pi * (60 * h + m) / 360, math.pi * m / 30 rad = min(abs(hrad - mrad), 2*math.pi - abs(hrad - mrad)) print((a ** 2 + b ** 2 - 2 * a * b * math.cos(rad))** 0.5)
[["+", 12, 652, 3, 4, 0, 657, 31, 657, 31, 612], ["+", 12, 652, 3, 4, 0, 657, 31, 657, 17, 48]]
5
96
A, B, H, M = map(int, input().split()) X, Y = A*math.cos(math.pi*(60*H+M)/360), -A*math.sin(math.pi*(60*H+M)/360) x, y = B*math.cos(math.pi*M/30), -B*math.sin(math.pi*M/30) print(math.sqrt((X-x)**2+(Y-y)**2))
import math A, B, H, M = map(int, input().split()) X, Y = A*math.cos(math.pi*(60*H+M)/360), -A*math.sin(math.pi*(60*H+M)/360) x, y = B*math.cos(math.pi*M/30), -B*math.sin(math.pi*M/30) print(math.sqrt((X-x)**2+(Y-y)**2))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
123
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; typedef long long int ll; const long long INF = 1LL << 60; ll MOD = 1e9 + 7; int main() { double A, B, H, M; cin >> A >> B >> H >> M; double tyosin, tansin; tyosin = H / 12 + (M / 60 / 12); tansin = M / 60; double thita = min((abs(tyosi...
#define _LIBCPP_DEBUG 0 #include <bits/stdc++.h> using namespace std; typedef long long int ll; const long long INF = 1LL << 60; ll MOD = 1e9 + 7; int main() { double A, B, H, M; cin >> A >> B >> H >> M; double tyosin, tansin; tyosin = H / 12 + (M / 60 / 12); tansin = M / 60; double thita = min((abs(tyosi...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
164
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back #define debug(x) cerr << ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back #define debug(x) cerr << ...
[["-", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13], ["+", 0, 1, 0, 11, 12, 16, 12, 16, 12, 13]]
1
290
#include <bits/stdc++.h> #include <iomanip> using namespace std; int main() { int a, b, h, m; float mi, ho, rad, distance; cin >> a >> b >> h >> m; mi = m / 60.0; ho = m / 720.00 + h / 12.00; rad = 2 * 3.14159265358979323846 * (mi - ho); distance = sqrt(a * a + b * b - 2 * a * b * cos(rad)); cout << fix...
#include <bits/stdc++.h> #include <iomanip> using namespace std; int main() { long long a, b, h, m; long double mi, ho, rad, distance; cin >> a >> b >> h >> m; mi = m / 60.0; ho = m / 720.00 + h / 12.00; rad = 2 * 3.14159265358979323846 * (mi - ho); distance = sqrt(a * a + b * b - 2 * a * b * cos(rad)); ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 39, 40]]
1
105
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define mod 1000000007 #define ten5 100005 #define ten52 200005 #define ten6 1000005 #...
#include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> using namespace std; #define mod 1000000007 #define ten5 100005 #define ten52 200005 #define ten6 1000005 #...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 0, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
311
#include <bits/stdc++.h> using namespace std; int main() { int A, B, H, M; cin >> A >> B >> H >> M; long double thetah, thetam, theta; thetah = 0.5 * (H * 60 + M); thetam = M * 10; theta = abs(thetam - thetah); long double l; l = sqrt((A * A + B * B) - (2 * (A * B) * cos((theta / 360) * 2 * M_PI))); ...
#include <bits/stdc++.h> using namespace std; int main() { int A, B, H, M; cin >> A >> B >> H >> M; long double thetah, thetam, theta; thetah = 0.5 * (H * 60 + M); thetam = M * 6; theta = abs(thetam - thetah); long double l; l = sqrt((A * A + B * B) - (2 * (A * B) * cos((theta / 360) * 2 * M_PI))); ...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
1
120
#include <bits/stdc++.h> typedef long long int ll; using namespace std; #define PI 3.14159265 void solve() { long double a, b, h, m; cin >> a >> b >> h >> m; m += h * 60; long double s = m * 59.5; while (s - 360 > 0) { s -= 360; } s *= PI / 180.0; long double ans = sqrt(a * a + b * b - 2 * a * b ...
#include <bits/stdc++.h> typedef long long int ll; using namespace std; #define PI 3.141592653589793238 void solve() { long double a, b, h, m; cin >> a >> b >> h >> m; m += h * 60; long double s = m * 5.5; while (s - 360 > 0) { s -= 360; } s *= PI / 180.0; long double ans = sqrt(a * a + b * b - 2...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
159
import math A,B,H,M= map(int,input().split()) kd_a=0.5*(M+60*H) kd_b=6*M rad=math.radians(kd_a-kd_b) X=A**2+B**2-2*A*B*math.cos(rad) print(X) print(X**0.5)
import math A,B,H,M= map(int,input().split()) kd_a=0.5*(M+60*H) kd_b=6*M rad=math.radians(kd_a-kd_b) X=A**2+B**2-2*A*B*math.cos(rad) print(X**0.5)
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 657, 31, 22]]
5
80
#include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> using namespace std; int main() { int a, b, h, m; const double PI = acos(-1); cin >> a >> b >> h >> m; double th = double(60 * h + m) * (PI / 360); double tm = double(m) * (PI / 30); double ...
#include <bits/stdc++.h> #include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> using namespace std; int main() { int a, b, h, m; const double PI = acos(-1); cin >> a >> b >> h >> m; double th = double(60 * h + m) * (PI / 360); double tm = double(m) * (PI / 30); double ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 31, 13], ["+", 51, 16, 12, 16, 31, 16, 31, 16, 17, 48]]
1
130
a, b, h, m = map(int, input().split()) import math s = abs(360*((h/12)+(m/720)) - 360*(m/60)-180) print(s) print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s))))
a, b, h, m = map(int, input().split()) import math s = abs(360*((h/12)+(m/720)) - 360*(m/60)) print(math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(s))))
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
89
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define MOD 998244353 using namespace std; using ll = long long; int main() { double a, b, h, m; cin >> a >> b >> h >> m; h = 30 * h + m / 2; m = m * 60; double rad = max(h, m) - min(h, m); if (rad > 180) rad = 360 - rad; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define MOD 998244353 using namespace std; using ll = long long; int main() { double a, b, h, m; cin >> a >> b >> h >> m; h = 30 * h + m / 2; m = m * 6; double rad = max(h, m) - min(h, m); if (rad > 180) rad = 360 - rad; r...
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
146
import math a = [int(s) for s in input().split()] b = int(max([a[0], a[1]])) c = int(min([a[0], a[1]])) d = 0.5 * (a[2] * 60 + a[3]) e = 6 * a[3] f = int(abs(int(d - int(e)))) if f >= 180: f = 360 - f if f != 0 and f!= 180: print(math.sqrt(a[0] ** 2 + a[1] ** 2 - 2 * a[0] * a[1] * math.cos(math.radians(f)))) elif ...
import math a = [int(s) for s in input().split()] b = int(max([a[0], a[1]])) c = int(min([a[0], a[1]])) d = 0.5 * (a[2] * 60 + a[3]) e = 6 * a[3] f = abs(d - int(e)) if f >= 180: f = 360 - f if f != 0 and f!= 180: print(math.sqrt(a[0] ** 2 + a[1] ** 2 - 2 * a[0] * a[1] * math.cos(math.radians(f)))) elif f == 0: ...
[["-", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 652, 3, 4, 0, 652, 63, 22], ["-", 3, 4, 0, 657, 12, 652, 3, 4, 0, 25], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
183
a, b, h, m = map(int, input().split()) ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360)) ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360)) bx = b * math.cos(math.radians(m/60 * 360)) by = b * math.sin(math.radians(m/60 * 360)) print(math.sqrt((ax-bx)**2 + (ay-by)**2))
import math a, b, h, m = map(int, input().split()) ax = a * math.cos(math.radians((h/12 + 1/12 * m/60) * 360)) ay = a * math.sin(math.radians((h/12 + 1/12 * m/60) * 360)) bx = b * math.cos(math.radians(m/60 * 360)) by = b * math.sin(math.radians(m/60 * 360)) print(math.sqrt((ax-bx)**2 + (ay-by)**2))
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22]]
5
139
import math A, B, H, M = map(int, input().split()) print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(30*H + 0.5*M - 60*M)))))
import math A, B, H, M = map(int, input().split()) print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(30*H + 0.5*M - 6*M)))))
[["-", 0, 652, 3, 4, 0, 657, 12, 657, 31, 612], ["+", 0, 652, 3, 4, 0, 657, 12, 657, 31, 612]]
5
68
import math A, B, H, M = map(int, input().split()) theta = abs(30 * H - 6 * M) if theta > 180: theta = 360 - theta ans = math.sqrt(A ** 2 + B ** 2 - (2 * A * B * math.cos(math.radians(theta)))) print(ans)
import math A, B, H, M = map(int, input().split()) theta = abs(30 * H + 0.5 * M - 6 * M) if theta > 180: theta = 360 - theta ans = math.sqrt(A ** 2 + B ** 2 - (2 * A * B * math.cos(math.radians(theta)))) print(ans)
[["+", 12, 652, 3, 4, 0, 657, 31, 657, 17, 72], ["+", 3, 4, 0, 657, 31, 657, 12, 657, 31, 531], ["+", 3, 4, 0, 657, 31, 657, 12, 657, 17, 48], ["+", 3, 4, 0, 657, 31, 657, 12, 657, 12, 22]]
5
82
#include <bits/stdc++.h> using namespace std; int main() { int a, b, h, m; cin >> a >> b >> h >> m; int p = 0.5 * m + 30 * h; int q = 6 * m; double kakudo = min(360 - abs(p - q), abs(p - q)); double t = cos(kakudo * M_PI / 180); cout << fixed << setprecision(15) << sqrt(a * a + b * b - 2 * a * b * t) ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, h, m; cin >> a >> b >> h >> m; double p = 0.5 * m + 30 * h; int q = 6 * m; double kakudo = min(360 - abs(p - q), abs(p - q)); double t = cos(kakudo * M_PI / 180); cout << fixed << setprecision(15) << sqrt(a * a + b * b - 2 * a * b * t) ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
116
import math a,b,h,m=map(int, input().split()) a_x=math.cos(abs(math.radians(60*m)-math.radians(30*h+0.5*m))) print((a**2+b**2-2*a*b*a_x)**0.5)
import math a,b,h,m=map(int, input().split()) a_x=math.cos(abs(math.radians(6*m)-math.radians(30*h+0.5*m))) print((a**2+b**2-2*a*b*a_x)**0.5)
[["-", 0, 657, 31, 652, 3, 4, 0, 657, 31, 612], ["+", 0, 657, 31, 652, 3, 4, 0, 657, 31, 612]]
5
75
from math import cos, pi A, B, H, M = map(int, input().split()) t1 = 30 * H + M / 60 * 30 t2 = 60 * M ans = A ** 2 + B ** 2 - 2 * A * B * cos(abs(t1 - t2) * pi / 180) print(ans ** 0.5)
from math import cos, pi A, B, H, M = map(int, input().split()) t1 = 30 * H + M / 60 * 30 t2 = 6 * M ans = A ** 2 + B ** 2 - 2 * A * B * cos(abs(t1 - t2) * pi / 180) print(ans ** 0.5)
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612]]
5
77
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, s, n) for (int i = s; i < (n); i++) #define ALL(a) a.begin(), a.end() #define RALL(a) a.rbegin(), a.rend() template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class ...
[["-", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22], ["+", 0, 16, 31, 16, 31, 16, 31, 16, 31, 22]]
1
262
/* maybemaybemaybeno */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define f(i, s, n) for (int i = s; i < (int)n; i++) // const int MAXN = 2e5+5 ; #define pb push_back #define X first #define Y second #define pii pair<int, int> #define pll pair<ll, ll> #define pli pair<l...
/* maybemaybemaybeno */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define f(i, s, n) for (int i = s; i < (int)n; i++) // const int MAXN = 2e5+5 ; #define pb push_back #define X first #define Y second #define pii pair<int, int> #define pll pair<ll, ll> #define pli pair<l...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78]]
1
168
import math A, B, H, M = map(int, input().split()) arg = H*360/12-M*360/60 print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(arg))))
import math A, B, H, M = map(int, input().split()) arg = H*360/12-M*360/60+M*0.5 print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(arg))))
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 31, 22], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 12, 657, 12, 531]]
5
68
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Main { public static void main(String[] args) throws java.lang.Exception { // your code goes here Scanner s ...
/* package whatever; // don't place package name! */ import java.io.*; import java.lang.*; import java.util.*; /* Name of the class has to be "Main" only if the class is public. */ public final class Main { public static void main(String[] args) throws java.lang.Exception { // your code goes here Scanner s ...
[["+", 3, 4, 0, 16, 31, 74, 39, 511, 0, 512], ["+", 51, 492, 3, 4, 0, 16, 31, 74, 0, 25], ["+", 3, 4, 0, 16, 31, 74, 51, 23, 0, 24], ["+", 51, 492, 3, 4, 0, 16, 12, 74, 0, 24], ["+", 3, 4, 0, 16, 12, 74, 39, 511, 0, 512], ["+", 51, 492, 3, 4, 0, 16, 12, 74, 0, 25]]
3
165
import math a,b,h,m = map(float, input().split()) ans = (a**2 + b**2 -2*a*b*math.cos(2*math.pi*(h/12 + m/60/12)))**(1/2) print("%.10f" % ans)
import math a,b,h,m = map(float, input().split()) ans = (a**2 + b**2 -2*a*b*math.cos(2*math.pi*(h/12 + m/60/12 - m/60)))**(1/2) print("%.10f" % ans)
[["+", 3, 4, 0, 657, 12, 23, 0, 657, 17, 33], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 31, 22], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 17, 85], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 12, 612]]
5
76
#include <bits/stdc++.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define sim te...
#include <bits/stdc++.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL) #define sim te...
[["-", 8, 123, 0, 171, 0, 124, 365, 16, 12, 13], ["+", 8, 123, 0, 171, 0, 124, 365, 16, 12, 13]]
1
419
import math a,b,h,m=map(int, input().split()) h_kaku=(2*math.pi*h)/12 m_kaku=(2*math.pi*m)/60 h_x=a * math.cos(-h_kaku+math.pi/2) h_y=a * math.sin(-h_kaku+math.pi/2) m_x=b * math.cos(-m_kaku+math.pi/2) m_y=b * math.sin(-m_kaku+math.pi/2) nagasa=math.sqrt((h_x-m_x)**2+(h_y-m_y)**2) print(nagasa)
import math a,b,h,m=map(int, input().split()) h_kaku=(2*math.pi*(h+m/60))/12 m_kaku=(2*math.pi*m)/60 h_x=a * math.cos(-h_kaku+math.pi/2) h_y=a * math.sin(-h_kaku+math.pi/2) m_x=b * math.cos(-m_kaku+math.pi/2) m_y=b * math.sin(-m_kaku+math.pi/2) nagasa=math.sqrt((h_x-m_x)**2+(h_y-m_y)**2) print(nagasa)
[["+", 12, 657, 31, 23, 0, 657, 12, 23, 0, 24], ["+", 31, 23, 0, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 31, 22], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 17, 85], ["+", 0, 657, 12, 23, 0, 657, 12, 657, 12, 612], ["+", 12, 657, 31, 23, 0, 657, 12, 23, 0, 25]]
5
142