Submission #446656
Source Code Expand
#define _USE_MATH_DEFINES #include <iostream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; int A, B, C; double f(double x){ return A*x + sin(M_PI*x*C); } const double error = 1009093.12984; double g(double l, double r){ if ( f(l) > f(r) ){ swap(l, r); } double ave; for ( int i = 0; i < 20; i++ ){ ave = ( l + r ) / 2; double x = f(ave); if ( abs(x - 100) <= 0.000001 )return ave; if ( 100 < x ){//todo < r = ave; } else{ l = ave; } } return error; } int main(){ cin >> A >> B >> C; //max of sinx ; x=(n+1/4)*2pi //min of sinx ; x=(n-1/4)*2pi //x=c*pi //c/2=n+1/4 double near = 100.0 / A; double a = ( C*near - 0.5 ); double l = ( floor(a) + 0.5 ) / C; double r = ( ceil(a) + 0.5 ) / C; for ( int i = 0; ; i++ ) { double x; { double L=l, R=r; double y = i * C; L += y; R += y; x = g(L, R); } if ( x != error ) { cout << setprecision(100) << x << endl; break; } //todo break = if-else } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - 25個の整数 |
User | toikage |
Language | C++14 (Clang++ 3.4) |
Score | 0 |
Code Size | 1070 Byte |
Status | WA |
Exec Time | 5043 ms |
Memory | 936 KB |
Judge Result
Set Name | Sample | Subtask1 | Subtask2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 30 | 0 / 70 | ||||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt |
Subtask1 | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt |
Subtask2 | sample-01.txt, sample-02.txt, sample-03.txt, sample-04.txt, test-1-01.txt, test-1-02.txt, test-1-03.txt, test-1-04.txt, test-1-05.txt, test-1-06.txt, test-1-07.txt, test-1-08.txt, test-1-09.txt, test-1-10.txt, test-1-11.txt, test-1-12.txt, test-1-13.txt, test-1-14.txt, test-1-15.txt, test-2-01.txt, test-2-02.txt, test-2-03.txt, test-2-04.txt, test-2-05.txt, test-2-06.txt, test-2-07.txt, test-2-08.txt, test-2-09.txt, test-2-10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample-01.txt | TLE | 5035 ms | 904 KB |
sample-02.txt | WA | 23 ms | 924 KB |
sample-03.txt | WA | 23 ms | 796 KB |
sample-04.txt | WA | 23 ms | 800 KB |
test-1-01.txt | TLE | 5032 ms | 800 KB |
test-1-02.txt | WA | 24 ms | 800 KB |
test-1-03.txt | TLE | 5034 ms | 804 KB |
test-1-04.txt | TLE | 5040 ms | 868 KB |
test-1-05.txt | TLE | 5034 ms | 804 KB |
test-1-06.txt | TLE | 5034 ms | 800 KB |
test-1-07.txt | TLE | 5033 ms | 812 KB |
test-1-08.txt | TLE | 5033 ms | 804 KB |
test-1-09.txt | TLE | 5031 ms | 804 KB |
test-1-10.txt | WA | 23 ms | 800 KB |
test-1-11.txt | TLE | 5033 ms | 924 KB |
test-1-12.txt | TLE | 5031 ms | 796 KB |
test-1-13.txt | TLE | 5033 ms | 932 KB |
test-1-14.txt | TLE | 5031 ms | 920 KB |
test-1-15.txt | TLE | 5033 ms | 872 KB |
test-2-01.txt | TLE | 5034 ms | 796 KB |
test-2-02.txt | TLE | 5033 ms | 800 KB |
test-2-03.txt | TLE | 5033 ms | 808 KB |
test-2-04.txt | TLE | 5033 ms | 872 KB |
test-2-05.txt | TLE | 5033 ms | 928 KB |
test-2-06.txt | TLE | 5043 ms | 936 KB |
test-2-07.txt | TLE | 5033 ms | 808 KB |
test-2-08.txt | TLE | 5034 ms | 796 KB |
test-2-09.txt | TLE | 5032 ms | 812 KB |
test-2-10.txt | TLE | 5033 ms | 796 KB |