Submission #1369337


Source Code Expand

#include<string>
#include<vector>
#include<iomanip>
#ifndef _WIN32
#include<iostream>
#endif
#include<algorithm>
#include<functional>
using namespace std;
#define FOR(i,bg,ed) for(int i =(bg); i< (ed);i++)
#define REP(i,n) FOR(i,0,n) 

struct cww{
	cww(){
		cout << fixed;
		cout << setprecision(10);
		ios::sync_with_stdio(false);
		cin.tie(0);
	}
}star;
typedef long long LL;
const int mod = 1e9 + 7;
typedef vector<int> V;
typedef vector<V> VV;

template<typename T>
istream& operator>>(istream& is, vector<T>& v){
	for (auto &it : v)is >> it;
	return is;
}
double pi = acos(-1);

int main(){
	double A, B, C;
	cin >> A >> B >> C;
	double ok = 0;
	double ng = 1000;
	auto f = [&](double t){
		return A*t + B*sin(C*pi*t);
	};
	REP(loop, 100){
		const double mid = (ok + ng) / 2;
		if (f(mid) <= 100)ok = mid;
		else ng = mid;
	}
	cout << ok << endl;

}

Submission Info

Submission Time
Task D - 高橋君ボール1号
User btk15049
Language C++14 (GCC 5.4.1)
Score 0
Code Size 901 Byte
Status CE

Compile Error

./Main.cpp:31:20: error: ‘acos’ was not declared in this scope
 double pi = acos(-1);
                    ^
./Main.cpp: In lambda function:
./Main.cpp:39:28: error: ‘sin’ was not declared in this scope
   return A*t + B*sin(C*pi*t);
                            ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:43:17: error: invalid operands of types ‘void’ and ‘int’ to binary ‘operator<=’
   if (f(mid) <= 100)ok = mid;
                 ^