Submission #6488100


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

double a,b,c;
const double pi = 3.141592653589793;
double f(double t){
	return a*t+b*sin(c*t*pi);
}
int main(){
	cin>>a>>b>>c;
	double hi=0;
	for(hi=0;hi<=300;hi++){
		if(f((double)hi)>=100)break;
	}
	double lb=hi-1;
	double ub=hi;
	for(int i=0;i<1000;i++){
		double mid=(lb+ub)/2;
		if(f(mid)>=100)ub=mid;
		else lb=mid;
	}
	printf("%.15f",lb);
	return 0;
}

Submission Info

Submission Time
Task D - 高橋君ボール1号
User latter0206
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1244 Byte
Status AC
Exec Time 6 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 17
Set Name Test Cases
Sample example_0.txt, example_1.txt
All example_0.txt, example_1.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, special_0.txt, special_1.txt, special_2.txt, example_0.txt, example_1.txt
Case Name Status Exec Time Memory
example_0.txt AC 6 ms 640 KB
example_1.txt AC 1 ms 256 KB
random_0.txt AC 1 ms 256 KB
random_1.txt AC 1 ms 256 KB
random_2.txt AC 1 ms 256 KB
random_3.txt AC 1 ms 256 KB
random_4.txt AC 1 ms 256 KB
random_5.txt AC 1 ms 256 KB
random_6.txt AC 1 ms 256 KB
random_7.txt AC 1 ms 256 KB
random_8.txt AC 1 ms 256 KB
random_9.txt AC 1 ms 256 KB
special_0.txt AC 1 ms 256 KB
special_1.txt AC 1 ms 256 KB
special_2.txt AC 2 ms 256 KB