수학 22번 1초짜리 풀이
/**
* author: pizzaroot
* created: 2023-11-19 02:14:54
**/
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
double f(double x, double b, double c, double d) {
return x * x * x + b * x * x + c * x + d;
}
double fprime(double x, double b, double c) {
return 3 * x * x + 2 * b * x + c;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
vector<pair<double, double>> cands;
for (double b = -10; b < 10; b += 0.02) {
for (double d = -10; d < 10; d += 0.02) {
double x = -1.0 / 4;
double c = -1.0 / 4 - 3 * x * x - 2 * b * x;
if (fprime(1.0 / 4, b, c) > 0.03) continue;
bool good = true;
for (int k = -50; k < 50; k++) {
if (f(k - 1, b, c, d) * f(k + 1, b, c, d) < -0.03) good = false;
}
if (good) {
cands.push_back({b, d});
}
}
}
for (auto &cd: cands) {
for (double b = cd.first - 2; b < cd.first + 2; b += 0.001) {
for (double d = cd.second - 2; d < cd.second + 2; d += 0.001) {
double x = -1.0 / 4;
double c = -1.0 / 4 - 3 * x * x - 2 * b * x;
if (fprime(1.0 / 4, b, c) > 0.0001) continue;
bool good = true;
for (int k = -5; k < 5; k++) {
if (f(k - 1, b, c, d) * f(k + 1, b, c, d) < -0.001) good = false;
}
if (good) {
cout << f(8, b, c, d) << '\n';
}
}
}
}
return 0;
}
1초만에 실행됨 ㄷㄷ
0 XDK (+0)
유익한 글을 읽었다면 작성자에게 XDK를 선물하세요.
-
안녕하세요! 참 이렇게 다시 말하기 싫었지만 점점 시험이 1주일씩 다가 올때마다...
-
웹툰정주행했는데 0
여기가 어디지... 분명 10시에 시작했는데
-
장발 관둘까 0
ㅎㅎ
-
기구하다 0
기구하다
-
장학금 지급 이것때문인듯 이거 보고 온게 큰데 지급방식도 홈페이지에 명시 안해두고...
-
선풍기를 침대 머리쪽으로 쐬게 놨어..
-
집앞에 사고난듯 3
끼이익 쾅 소리남 차vs차는 아닌거같고 혼자 박은건가
-
개미친얼버기 8
-
가능함? 6모3 9모4 나왔고 6모 친 뒤로 국어 하나도 손 안댔는데 수능때도...
-
지거국 이상이면 어차피 다 자기하기 나름인것같애 물론 메디컬 빼고 ㅇㅇ
-
지구과학 질문 1
섭입대에서 잡아당기는 힘이 작용할 때 섭입하는 판이 섭입되는 판을 잡아당기는건가요,...
-
어그로 ㅈㅅ합니다 일년 반 쓰던 샤프가 방금 요절했습니다 몇주전부터 맛탱이가...
-
a구하는 아이디어가 좋죠 2번째 사진은 구글에 2022 10 12검색해서 뜨는 아무...
-
....
-
수능 50일 14
문과 평균 4~5등급인데 평균 3등급 바라는 건 너무 욕심이겠죠 가천대나 경기대 꼭...
-
참아라 나 자신
-
흠
-
걍 정신만 썩은듯 분명 투입을 안한게아닌데 결과가 안나와
-
인스타 보니까 싹다 연고전이야 하긴 청춘이 최고다
-
끝말잇기가 아니고 연상되는 단어를 말하는거임 예를들면 사람 영장류 원숭이 이렇게요
-
님 말 다 맞으니까 평생 그렇게 생각하고 사셔요^^
-
쓰다가 매일 똑같은 식의 공부를 해서 굳이 안쓰고있긴한데 10일 후면 26수능 딱...
-
지듣노 0
촛불 켜면 감성 ㅈ되는데
-
그렇다고 도서관 가기는 또 귀찮아서 논문 피뎁을 벅벅 보는 걸 즐기는 나
-
특히 수학같은게 6~7월에 전성기였다가 9월쯤에 존나 쇠퇴함 작년에도 재작년에도...
-
제곧내임 자습시간도 많이 확보할 수 있고 국수탐 다 잘가르치는 과외생들한테 과외만 받는게 나을까요?
-
젊어지고 싶다 5
너무 늙어버린것 같음..
-
통일교 보면 진짜 뭐지 싶음 님들은 이해가됨? 일본은 싫지만 일본여행 가는거랑 동급 아닌가
-
원래 이거 사려고 갔음 등급 상이라고 돼 있는데 책등 변색돼 있어서 열받았지만...
-
현우진이 잘생겨 보임
-
9평 끝나고부터 이렇게 살았는데
-
끝말잇기할사람 41
고?
-
잘생겼다 1
는 것은 외모를 통해서 많은 사람의 호감을 산다는 것입니다.
-
1. 모든것은 대상이다 2. 대상은 대상으로 이루어진다 표기법 대상1=대상2+대상3...
-
펀쿨섹좌 잘생김 1
알파남인 듯
-
순천 살인마처럼 2
뒤에서 슬금슬금 다가와서 찌르는 건 어떻게 피해야함? ㅅㅂ.. 피할 수가 있긴 하나
-
전과목 다 그렇게 공부했음 다음에 하면 이해할거라는 마인든데 상당히 글러먹은듯...
-
lim (x->0) f(x)/x² = 0일 때 f''(0)=0이다? 16
단 f(x)는 미분가능한 함수 (수정하면서 추가함) 증명하거나 반례 들면 덕코 다줄게
-
잠이 안와요 6
고대의 검은 캔버스는 누구의 것이었던가 살별의 꼬리로 채워넣은 은빛 해변 달빛을...
-
원함수가 미분가능하면 도함수는 연속인가요? 원함수가 실수전체에서 미분가능하면...
-
포르쉐 카이안 하이브리드가 드림칸데 못 산다 살 돈 있어도 어떻게 모은돈인데 차에...
-
대학교 오랜만에 갔다오느라 공부안해서 오르비안함ㅌㅌ 0
체육대회하고옴 축구 농구 대표로 나가서 캐리좀 했다 휴학생도 불러주네 나갈...
-
이러고선 수2 확통 화학 생명 영어 23등급 맞고 중간끝나고 여러 애들헌테 무시와...
-
1. 모든것은 대상이다 2. 대상은 대상으로 이루어진다 표기법 대상1=대상2+대상3...
-
정보 4대 2로 이김 파머 포트트릭 그냥 그렇다구요 신나서 적어봤어요 잘께요
-
연애 어떻게함 그거..
-
돈 모으기 ㅋㅋㅋ 재워주지 밥 주지 나갈돈이 없는데 월급도 인상?? 군대가가전 천...
-
21살 먹고 보기 괜찮음요? 가끔 드라마 보고싶네
^오^