Submission #19514293


Source Code Expand

Copy
// 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;

using l = long;
using ll = long long;
using ld = long double;
using db = double;
using str = string;

using pi = pair<int,int>;
using pl = pair<ll,ll>;
using pd = pair<db,db>;

using vi = vector<int>;
using vl = vector<long>;
using vll = vector<ll>;

#define mp make_pair
#define f first
#define s second

#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back

void divisors(map<int,int>& d,ll N){
	for(int div : {2,3,5}){
		int cnt=1;
		if(N%2==0){
			while((N%2)==0){
				N/=2;
				cnt++;
			}
			d[div]=cnt;
		}
	}
	static array<int,8> increments = {4,2,4,2,4,6,2,6};
	int i=0;
	for(ll div=7;div*div<=N;div+=increments[i++]){
		if((N%div)==0){
			int cnt=1;
			while((N%i)==0){
				N/=i;
				cnt++;
			}
			d[i]=cnt;
		}
		if(i==8)
			i=0;
	}
	if(N>1)
		d[N]=2;
}

void input(vl& v,int N){
	for(int i=0;i<N;i++){
		cin>>v[i];
	}
}

void solve(int a,int b,int h,int m){
	long double PI=3.14159265358979323846264338327950L;
	
	long double hans=(long double)30*(h+m/(double)60);
	long double mans=(long double)6*m;
	long double theta=(long double)hans-mans;
	
	theta=(long double)min(theta,360.0-theta);
	long double x=(theta*PI)/180;
	long double res=(long double)(a*a + b*b) -(long double)(2.0*a*b)*cosl(x);
	printf("%.20f",sqrtf(res));
	
	
}

int main(){
	int a,b,h,m;
	cin>>a>>b>>h>>m;
	solve(a,b,h,m);
	return 0;	
}

Submission Info

Submission Time
Task C - : (Colon)
User VaibhavSethia07
Language C++ (GCC 9.2.1)
Score 0
Code Size 1836 Byte
Status WA
Exec Time 15 ms
Memory 4088 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 1
AC × 7
WA × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
Subtask1 sample_01.txt, sample_02.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt
Case Name Status Exec Time Memory
sample_01.txt AC 15 ms 3948 KB
sample_02.txt WA 5 ms 4088 KB
sub1_01.txt AC 2 ms 3640 KB
sub1_02.txt WA 3 ms 3768 KB
sub1_03.txt WA 2 ms 3912 KB
sub1_04.txt AC 2 ms 3884 KB
sub1_05.txt AC 2 ms 3924 KB
sub1_06.txt AC 3 ms 3604 KB
sub1_07.txt WA 2 ms 3708 KB
sub1_08.txt WA 2 ms 3860 KB
sub1_09.txt WA 2 ms 4036 KB
sub1_10.txt WA 2 ms 3804 KB
sub1_11.txt WA 2 ms 3936 KB
sub1_12.txt WA 3 ms 3956 KB
sub1_13.txt WA 2 ms 3656 KB
sub1_14.txt WA 2 ms 3936 KB
sub1_15.txt AC 2 ms 4088 KB
sub1_16.txt WA 2 ms 3960 KB
sub1_17.txt WA 2 ms 3884 KB
sub1_18.txt WA 2 ms 3996 KB
sub1_19.txt WA 2 ms 3708 KB
sub1_20.txt WA 2 ms 3992 KB
sub1_21.txt WA 2 ms 3600 KB
sub1_22.txt AC 2 ms 3596 KB
sub1_23.txt WA 2 ms 3612 KB
sub1_24.txt WA 2 ms 3900 KB
sub1_25.txt WA 2 ms 3992 KB
sub1_26.txt WA 3 ms 3564 KB
sub1_27.txt WA 2 ms 3896 KB
sub1_28.txt WA 2 ms 3892 KB