Files
Learn_System/backend/src/db/seed-math.js
T
Maxim Dolgolyov be4d43105e LearnSpace: full-stack educational whiteboard platform
Node.js/Express backend + vanilla JS frontend.
Features: real-time collaborative whiteboard (SSE), multi-page support,
LaTeX formulas, shapes/connectors, coordinate systems, number lines,
compass, zoom/pan, Catmull-Rom pencil smoothing, ruler/protractor with
rotation & resize controls, minimap navigation overlay, auto-measurements,
multi-page thumbnails sidebar, PNG export, page templates.
Student/teacher workflows: classes, assignments, library, dashboard.
Mobile responsive. SQLite (better-sqlite3).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 10:10:37 +03:00

668 lines
36 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Seed: Математика — вопросы для тестов
*
* Источники:
* — 21 вопрос ЦТ/ЦЭ (общие)
* — 32 вопроса ЦТ 2021, Вариант 1 (A1A18 + B1B14)
*
* Запуск: node src/db/seed-math.js (из папки backend/)
*/
const db = require('./db');
/* ── helpers ─────────────────────────────────────────────────────────── */
function getOrCreateTopic(subjectId, name) {
const ex = db.prepare('SELECT id FROM topics WHERE subject_id=? AND LOWER(name)=LOWER(?)').get(subjectId, name);
if (ex) return ex.id;
return db.prepare('INSERT INTO topics (subject_id, name) VALUES (?,?)').run(subjectId, name).lastInsertRowid;
}
/* ── subject ─────────────────────────────────────────────────────────── */
const math = db.prepare("SELECT id FROM subjects WHERE slug='math'").get();
if (!math) { console.error('Subject "math" not found. Run migrate first.'); process.exit(1); }
const SID = math.id;
/* ═══════════════════════════════════════════════════════════════════════
Вопросы
Поля: topic, difficulty, text, options[{text,correct}], explanation
Необязательные: year (число), type ('single'|'multiple')
═══════════════════════════════════════════════════════════════════════ */
const questions = [
/* ══════════════════════════════════════════════════════════════════════
РАЗДЕЛ 1 — Общие задания ЦТ/ЦЭ
══════════════════════════════════════════════════════════════════════ */
{
topic: 'Арифметика и степени', difficulty: 1,
text: 'Вычислите: \\((-3)^2 - 2^3 + 1\\)',
options: [
{ text: '\\(2\\)', correct: true },
{ text: '\\(4\\)', correct: false },
{ text: '\\(0\\)', correct: false },
{ text: '\\(-2\\)', correct: false },
{ text: '\\(18\\)', correct: false },
],
explanation: '\\((-3)^2=9,\\;2^3=8.\\;9-8+1=2\\)',
},
{
topic: 'Словесные задачи', difficulty: 1,
text: 'Толя купил 3 альбома и 5 карандашей. Стоимость альбома — 1 р. 20 к., карандаша — 25 к. Сколько копеек осталось у Толи после покупки, если всего у него было 6 р.?',
options: [
{ text: '115 к.', correct: true },
{ text: '145 к.', correct: false },
{ text: '110 к.', correct: false },
{ text: '125 к.', correct: false },
{ text: '275 к.', correct: false },
],
explanation: '3·120+5·25=360+125=485 к. Остаток: 600485=115 к.',
},
{
topic: 'Теория чисел', difficulty: 1,
text: 'Укажите формулу для нахождения делимого \\(n\\), если делитель равен 15, неполное частное \\(k\\), остаток 7:',
options: [
{ text: '\\(n=15k+7\\)', correct: true },
{ text: '\\(n=15(k+7)\\)', correct: false },
{ text: '\\(n=k+22\\)', correct: false },
{ text: '\\(n=7k+15\\)', correct: false },
],
explanation: 'По теореме о делении с остатком: \\(n=d\\cdot q+r=15k+7\\)',
},
{
topic: 'Тригонометрия', difficulty: 1,
text: 'Среди значений \\(-\\dfrac{\\pi}{6};\\;\\dfrac{\\pi}{4};\\;\\dfrac{\\pi}{3};\\;-\\dfrac{3\\pi}{2};\\;-6\\pi\\) укажите то, при котором \\(\\sin x=0\\):',
options: [
{ text: '\\(-6\\pi\\)', correct: true },
{ text: '\\(-\\dfrac{\\pi}{6}\\)', correct: false },
{ text: '\\(\\dfrac{\\pi}{4}\\)', correct: false },
{ text: '\\(-\\dfrac{3\\pi}{2}\\)', correct: false },
],
explanation: '\\(\\sin(-6\\pi)=0\\), так как \\(-6\\pi\\) кратно \\(\\pi\\).',
},
{
topic: 'Квадратные уравнения', difficulty: 2,
text: 'Укажите квадратное уравнение, произведение действительных корней которого равно 5:',
options: [
{ text: '\\(x^2-6x+5=0\\)', correct: true },
{ text: '\\(x^2-4x+5=0\\)', correct: false },
{ text: '\\(x^2-5x+6=0\\)', correct: false },
{ text: '\\(x^2+5x=0\\)', correct: false },
],
explanation: 'По формуле Виета произведение корней \\(=c/a\\). Для \\(x^2-6x+5=0\\): \\(5/1=5\\). Корни: \\(x=1,\\;x=5\\).',
},
{
topic: 'Тригонометрия', difficulty: 2,
text: 'Найдите значение выражения \\(\\dfrac{38}{\\pi}\\cdot\\arcsin(-1)-|-7|\\)',
options: [
{ text: '\\(-26\\)', correct: true },
{ text: '\\(-16\\)', correct: false },
{ text: '\\(-12\\)', correct: false },
{ text: '\\(26\\)', correct: false },
],
explanation: '\\(\\arcsin(-1)=-\\dfrac{\\pi}{2}\\). Тогда: \\(\\dfrac{38}{\\pi}\\cdot(-\\dfrac{\\pi}{2})-7=-19-7=-26\\).',
},
{
topic: 'Квадратные уравнения', difficulty: 1,
text: 'Найдите нули функции \\(f(x)=x^2+4x-5\\):',
options: [
{ text: '\\(x=-5\\) и \\(x=1\\)', correct: true },
{ text: '\\(x=5\\) и \\(x=-1\\)', correct: false },
{ text: '\\(x=5\\) и \\(x=1\\)', correct: false },
{ text: '\\(x=-5\\) и \\(x=-1\\)', correct: false },
],
explanation: 'Дискриминант: \\(16+20=36\\). \\(x_{1,2}=\\dfrac{-4\\pm6}{2}\\). \\(x_1=-5,\\;x_2=1\\).',
},
{
topic: 'Тригонометрия', difficulty: 2,
text: 'Найдите \\(\\operatorname{ctg}^2\\alpha\\), если \\(\\sin\\alpha=\\dfrac{1}{5}\\):',
options: [
{ text: '\\(24\\)', correct: true },
{ text: '\\(\\frac{1}{24}\\)', correct: false },
{ text: '\\(4\\)', correct: false },
{ text: '\\(25\\)', correct: false },
],
explanation: '\\(\\cos^2\\alpha=1-\\tfrac{1}{25}=\\tfrac{24}{25}\\). \\(\\operatorname{ctg}^2\\alpha=\\dfrac{24/25}{1/25}=24\\).',
},
{
topic: 'Прогрессии', difficulty: 2,
text: 'Пятый член геометрической прогрессии равен 48, шестой — 96. Найдите первый член:',
options: [
{ text: '\\(3\\)', correct: true },
{ text: '\\(1\\)', correct: false },
{ text: '\\(2\\)', correct: false },
{ text: '\\(4\\)', correct: false },
],
explanation: '\\(q=96/48=2\\). \\(b_1=48/2^4=3\\).',
},
{
topic: 'Неравенства', difficulty: 2,
text: 'Сколько целых решений имеет неравенство \\(-3\\le2-\\dfrac{3x-2}{2}<27\\,\\)?',
options: [
{ text: '\\(20\\)', correct: true },
{ text: '\\(18\\)', correct: false },
{ text: '\\(19\\)', correct: false },
{ text: '\\(21\\)', correct: false },
],
explanation: 'Решение: \\(-15\\le x\\le4\\). Целые: от 15 до 4 → \\(4-(-15)+1=20\\) чисел.',
},
{
topic: 'Квадратные уравнения', difficulty: 1,
text: 'Функция \\(f(x)=x^2+4x-5\\). Найдите сумму нулей функции.',
options: [
{ text: '\\(-4\\)', correct: true },
{ text: '\\(4\\)', correct: false },
{ text: '\\(-5\\)', correct: false },
{ text: '\\(0\\)', correct: false },
],
explanation: 'По теореме Виета: \\(-b/a=-4\\).',
},
{
topic: 'Прогрессии', difficulty: 2,
text: 'Найдите сумму всех натуральных чисел, кратных 9, которые больше 141, но меньше 170.',
options: [
{ text: '\\(459\\)', correct: true },
{ text: '\\(468\\)', correct: false },
{ text: '\\(315\\)', correct: false },
{ text: '\\(414\\)', correct: false },
],
explanation: 'Числа: 144, 153, 162. Сумма: \\(144+153+162=459\\).',
},
{
topic: 'Геометрия', difficulty: 2,
text: 'Радиус описанной окружности прямоугольного треугольника \\(ABC\\) (\\(\\angle ABC=90°\\)) равен \\(18\\sqrt{2}\\). Найдите \\(90\\cdot\\cos\\angle ACB\\), если \\(BC=6\\sqrt{2}\\).',
options: [
{ text: '\\(15\\)', correct: true },
{ text: '\\(30\\)', correct: false },
{ text: '\\(45\\)', correct: false },
{ text: '\\(60\\)', correct: false },
],
explanation: '\\(AC=2R=36\\sqrt{2}\\). \\(\\cos\\angle ACB=\\dfrac{6\\sqrt{2}}{36\\sqrt{2}}=\\dfrac{1}{6}\\). Ответ: \\(15\\).',
},
{
topic: 'Словесные задачи', difficulty: 2,
text: 'Проездной на месяц стоит 39 р., разовый — 80 к. 75% потраченной Машей суммы равны стоимости проездного. Сколько поездок она совершила?',
options: [
{ text: '65', correct: true },
{ text: '52', correct: false },
{ text: '75', correct: false },
{ text: '60', correct: false },
],
explanation: '75% суммы=39 р. → сумма=52 р.=5200 к. Поездок: \\(5200/80=65\\).',
},
{
topic: 'Неравенства', difficulty: 2,
text: 'Найдите сумму наименьшего и наибольшего целых решений неравенства \\(-3\\le2-\\dfrac{3x-2}{2}<27\\).',
options: [
{ text: '\\(-11\\)', correct: true },
{ text: '\\(-10\\)', correct: false },
{ text: '\\(-12\\)', correct: false },
{ text: '\\(-14\\)', correct: false },
],
explanation: 'Целые решения: от −15 до 4. Сумма крайних: \\(-15+4=-11\\).',
},
{
topic: 'Функции', difficulty: 2,
text: 'Функция \\(y=f(x)\\) чётная. Точки \\(A(3;-\\tfrac{2}{3})\\) и \\(B(6;-\\tfrac{3}{4})\\) на графике. Найдите \\(6f(-3)+8f(-6)\\).',
options: [
{ text: '\\(-10\\)', correct: true },
{ text: '\\(10\\)', correct: false },
{ text: '\\(-6\\)', correct: false },
{ text: '\\(-4\\)', correct: false },
],
explanation: '\\(f(-3)=f(3)=-\\tfrac{2}{3}\\), \\(f(-6)=-\\tfrac{3}{4}\\). \\(6\\cdot(-\\tfrac{2}{3})+8\\cdot(-\\tfrac{3}{4})=-4-6=-10\\).',
},
{
topic: 'Логарифмы', difficulty: 3,
text: 'Найдите произведение корней уравнения \\(\\log_2^2x-2\\log_2x=\\log_224-\\log_23\\), умноженное на 11.',
options: [
{ text: '\\(44\\)', correct: true },
{ text: '\\(22\\)', correct: false },
{ text: '\\(88\\)', correct: false },
{ text: '\\(48\\)', correct: false },
],
explanation: 'Пусть \\(t=\\log_2x\\): \\(t^2-2t=3\\Rightarrow t=3\\) или \\(t=-1\\). Корни: \\(x=8,\\;x=\\tfrac{1}{2}\\). Произведение \\(=4\\). \\(4\\times11=44\\).',
},
{
topic: 'Геометрия', difficulty: 3,
text: 'Плоскость, параллельная основанию треугольной пирамиды, делит высоту в отношении \\(5:3\\) от вершины. Найдите площадь сечения, если она меньше площади основания на 39.',
options: [
{ text: '\\(25\\)', correct: true },
{ text: '\\(36\\)', correct: false },
{ text: '\\(16\\)', correct: false },
{ text: '\\(49\\)', correct: false },
],
explanation: '\\(k=\\tfrac{5}{8}\\). \\(S_{\\text{осн}}-\\tfrac{25}{64}S_{\\text{осн}}=39\\Rightarrow S_{\\text{осн}}=64\\). \\(S_{\\text{сеч}}=25\\).',
},
{
topic: 'Показательные неравенства', difficulty: 3,
text: 'Найдите наименьшее целое решение неравенства \\(8^{2x-32}+10\\cdot4^{3x-49}>56\\).',
options: [
{ text: '\\(17\\)', correct: true },
{ text: '\\(16\\)', correct: false },
{ text: '\\(18\\)', correct: false },
{ text: '\\(15\\)', correct: false },
],
explanation: 'Пусть \\(t=2^{6x-98}\\): \\(4t+10t>56\\Rightarrow t>4\\Rightarrow x>16{,}\\overline{6}\\). Мин. целое: 17.',
},
{
topic: 'Логарифмы', difficulty: 3,
text: 'Найдите произведение наименьшего и наибольшего целых решений неравенства \\(\\log_3^2(x+12)-\\log_3(x+12)-6<0\\).',
options: [
{ text: '\\(-154\\)', correct: true },
{ text: '\\(154\\)', correct: false },
{ text: '\\(-110\\)', correct: false },
{ text: '\\(-180\\)', correct: false },
],
explanation: 'Пусть \\(t=\\log_3(x+12)\\): \\(-2<t<3\\Rightarrow -11{,}88<x<15\\). Целые: от 11 до 14. \\(-11\\times14=-154\\).',
},
{
topic: 'Неравенства', difficulty: 2,
text: 'Решите неравенство \\(|2x-3|\\le7\\) и укажите число целых решений.',
options: [
{ text: '\\(8\\)', correct: true },
{ text: '\\(7\\)', correct: false },
{ text: '\\(9\\)', correct: false },
{ text: '\\(6\\)', correct: false },
],
explanation: '\\(-7\\le2x-3\\le7\\Rightarrow-2\\le x\\le5\\). Целые: \\(-2,-1,0,1,2,3,4,5\\) — 8 чисел.',
},
/* ══════════════════════════════════════════════════════════════════════
РАЗДЕЛ 2 — ЦТ 2021, Вариант 1
══════════════════════════════════════════════════════════════════════ */
{
topic: 'Геометрия', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A1]\n\nТреугольник \\(ABC\\) — равнобедренный с основанием \\(AB\\). Угол при вершине \\(C = 56°\\). Найдите угол \\(BAC\\).',
options: [
{ text: '62°', correct: true },
{ text: '68°', correct: false },
{ text: '34°', correct: false },
{ text: '64°', correct: false },
{ text: '28°', correct: false },
],
explanation: '\\(2\\cdot\\angle BAC=180°-56°=124°\\Rightarrow\\angle BAC=62°\\).',
},
{
topic: 'Арифметика и степени', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A2]\n\nСреди дробей \\(\\dfrac{13}{7};\\;\\dfrac{15}{7};\\;\\dfrac{30}{7};\\;\\dfrac{27}{7};\\;\\dfrac{18}{7}\\) укажите ту, которая равна \\(4\\dfrac{2}{7}\\).',
options: [
{ text: '\\(\\dfrac{13}{7}\\)', correct: false },
{ text: '\\(\\dfrac{15}{7}\\)', correct: false },
{ text: '\\(\\dfrac{30}{7}\\)', correct: true },
{ text: '\\(\\dfrac{27}{7}\\)', correct: false },
{ text: '\\(\\dfrac{18}{7}\\)', correct: false },
],
explanation: '\\(4\\dfrac{2}{7}=\\dfrac{30}{7}\\).',
},
{
topic: 'Уравнения', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A3]\n\nУкажите пару, которая НЕ является решением \\(x+y=12\\): \\((3;9)\\), \\((-15;3)\\), \\((0;12)\\), \\((14;-2)\\), \\((6;6)\\).',
options: [
{ text: '\\((3;9)\\)', correct: false },
{ text: '\\((-15;3)\\)', correct: true },
{ text: '\\((0;12)\\)', correct: false },
{ text: '\\((14;-2)\\)', correct: false },
{ text: '\\((6;6)\\)', correct: false },
],
explanation: '\\(-15+3=-12\\neq12\\).',
},
{
topic: 'Неравенства', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A4]\n\nСреди чисел \\(-7;-11;11;-1;0\\) укажите то, которое не меньше \\(-9\\) и не больше \\(-2\\).',
options: [
{ text: '\\(-7\\)', correct: true },
{ text: '\\(-11\\)', correct: false },
{ text: '\\(11\\)', correct: false },
{ text: '\\(-1\\)', correct: false },
{ text: '\\(0\\)', correct: false },
],
explanation: '\\(-9\\le-7\\le-2\\) — только \\(-7\\) подходит.',
},
{
topic: 'Словесные задачи', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A5]\n\nТочка \\(C\\) делит отрезок \\(AB\\) в отношении \\(5:3\\) от \\(A\\). Длина \\(AB=24\\). Найдите \\(CB\\).',
options: [
{ text: '\\(14{,}4\\)', correct: false },
{ text: '\\(9{,}6\\)', correct: false },
{ text: '\\(6\\)', correct: false },
{ text: '\\(9\\)', correct: true },
{ text: '\\(15\\)', correct: false },
],
explanation: '\\(CB=\\dfrac{3}{8}\\cdot24=9\\).',
},
{
topic: 'Словесные задачи', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A6]\n\nВ магазин поступило 43 коробки по 110 пачек масла. Какое наименьшее количество пачек нужно продавать ежедневно, чтобы распродать за не более чем 60 дней?',
options: [
{ text: '78', correct: false },
{ text: '81', correct: false },
{ text: '79', correct: true },
{ text: '83', correct: false },
],
explanation: '\\(43\\times110=4730\\). \\(\\lceil4730/60\\rceil=79\\).',
},
{
topic: 'Функции', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A7]\n\nНайдите количество целых \\(x\\in[-6;6]\\), при которых \\(f(x)\\le-3\\) (по графику функции).',
options: [
{ text: '7', correct: true },
{ text: '6', correct: false },
{ text: '5', correct: false },
{ text: '9', correct: false },
],
explanation: 'По графику: 7 целых значений.',
},
{
topic: 'Функции', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A8]\n\nУпростите \\(|a-6|-|a|\\) при \\(\\dfrac{1}{6}<a<\\dfrac{3}{8}\\).',
options: [
{ text: '\\(-6\\)', correct: false },
{ text: '\\(2a+6\\)', correct: false },
{ text: '\\(-2a-6\\)', correct: false },
{ text: '\\(6-2a\\)', correct: true },
],
explanation: '\\(|a-6|=6-a\\) и \\(|a|=a\\). Результат: \\(6-a-a=6-2a\\).',
},
{
topic: 'Логарифмы', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A9]\n\nЧему равно \\(\\log_798-\\log_78+\\log_7\\dfrac{4}{7}\\)?',
options: [
{ text: '\\(1\\)', correct: true },
{ text: '\\(2\\)', correct: false },
{ text: '\\(\\log_72\\)', correct: false },
{ text: '\\(0\\)', correct: false },
],
explanation: '\\(\\log_7\\dfrac{98\\cdot4}{8\\cdot7}=\\log_77=1\\).',
},
{
topic: 'Словесные задачи', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A10]\n\nВелосипедист в первый день проехал 52 км, во второй — на 15% меньше. Сколько км за два дня?',
options: [
{ text: '102,4', correct: false },
{ text: '96,2', correct: true },
{ text: '89', correct: false },
{ text: '88,4', correct: false },
],
explanation: '\\(52\\times0{,}85=44{,}2\\). Итого: \\(52+44{,}2=96{,}2\\).',
},
{
topic: 'Уравнения', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · A11]\n\nНайдите произведение координат точки пересечения прямых \\(6x-y=4\\) и \\(y-18=0\\).',
options: [
{ text: '4', correct: false },
{ text: '18', correct: false },
{ text: '72', correct: false },
{ text: '66', correct: true },
],
explanation: '\\(y=18\\Rightarrow6x=22\\Rightarrow x=\\tfrac{11}{3}\\). Произведение: \\(\\tfrac{11}{3}\\cdot18=66\\).',
},
{
topic: 'Функции', difficulty: 2, year: 2021, type: 'multiple',
text: '[ЦТ 2021 · A12]\n\nУкажите номера чётных функций:\n1) \\(y=0{,}2x^2\\)\n2) \\(y=8^{\\tfrac{x^4-16}{2|x|}}\\)\n3) \\(y=-\\dfrac{3}{x}\\)\n4) \\(y=x^2-x+2\\)\n5) \\(y=\\sin2x\\)',
options: [
{ text: '1', correct: true },
{ text: '2', correct: true },
{ text: '3', correct: false },
{ text: '4', correct: false },
{ text: '5', correct: false },
],
explanation: '1) ✓ чётная. 2) ✓ показатель не меняется при \\(x\\to-x\\). 3) нечётная. 4) ни чётная ни нечётная. 5) нечётная.',
},
{
topic: 'Геометрия', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A13]\n\nПлощадь прямоугольного треугольника равна 2, радиус описанной окружности \\(R\\). Укажите верную формулу суммы катетов \\(a+b\\).\n1) \\(\\dfrac{R^2+4}{R}\\)\n2) \\(\\sqrt{R^2+2}\\)\n3) \\(2\\sqrt{R^2+4}\\)\n4) \\(\\dfrac{R^2+2}{R}\\)\n5) \\(2\\sqrt{R^2+2}\\)',
options: [
{ text: '1', correct: false },
{ text: '2', correct: false },
{ text: '3', correct: false },
{ text: '4', correct: false },
{ text: '5', correct: true },
],
explanation: '\\(c=2R,\\;ab=4\\). \\((a+b)^2=4R^2+8\\Rightarrow a+b=2\\sqrt{R^2+2}\\).',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · A14]\n\nПрямая треугольная призма \\(ABCA_1B_1C_1\\): \\(\\angle A=20°\\), \\(\\angle C=25°\\), радиус описанной окружности \\(\\sqrt{7}\\). Площадь грани \\(AA_1C_1C=2\\sqrt{35}\\). Найдите длину диагонали этой грани.',
options: [
{ text: '\\(3\\sqrt{3}\\)', correct: false },
{ text: '\\(2\\sqrt{5}\\)', correct: false },
{ text: '\\(2\\sqrt{6}\\)', correct: true },
{ text: '\\(4\\sqrt{6}\\)', correct: false },
],
explanation: '\\(\\angle B=135°\\). \\(AC=\\sqrt{14}\\). \\(AA_1=\\sqrt{10}\\). Диагональ: \\(\\sqrt{14+10}=2\\sqrt{6}\\).',
},
{
topic: 'Квадратные уравнения', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A15]\n\nПараболы \\(y=2x^2+bx+c\\) с нулями \\(x=3\\) и \\(x=4\\). Найдите \\(b+c\\).',
options: [
{ text: '12', correct: false },
{ text: '5', correct: false },
{ text: '10', correct: true },
{ text: '14', correct: false },
],
explanation: '\\(b=-14,\\;c=24\\). \\(b+c=10\\).',
},
{
topic: 'Уравнения', difficulty: 2, year: 2021, type: 'multiple',
text: '[ЦТ 2021 · A16]\n\nУкажите номера равносильных уравнений:\n1) \\((x-6)(x+6)=0\\)\n2) \\(\\sqrt{x+10}=2\\)\n3) \\(x^2+36=0\\)\n4) \\(\\dfrac{x-x^2-5}{4}+\\dfrac{x^2-x-3}{3}=\\dfrac{1}{4}\\)\n5) \\(|x|-6=0\\)',
options: [
{ text: '1', correct: true },
{ text: '2', correct: false },
{ text: '3', correct: false },
{ text: '4', correct: false },
{ text: '5', correct: true },
],
explanation: 'Ур. 1 и 5 имеют одинаковые решения \\(x=\\pm6\\).',
},
{
topic: 'Геометрия', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · A17]\n\nТочки \\(A\\) и \\(B\\) — соседние вершины квадрата; \\(\\Delta x=7\\), \\(\\Delta y=2\\). Найдите площадь квадрата \\(ABCD\\).',
options: [
{ text: '37', correct: false },
{ text: '14', correct: false },
{ text: '50', correct: false },
{ text: '53', correct: true },
],
explanation: '\\(AB^2=7^2+2^2=53\\). Площадь \\(=AB^2=53\\).',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · A18]\n\nПравильная четырёхугольная пирамида \\(SABCD\\), все рёбра 48. \\(M\\) — середина \\(SD\\), \\(N\\in SC\\), \\(CN:NS=1:3\\). Плоскость через \\(M,N\\), параллельная \\(SA\\), пересекает основание по отрезку длиной…',
options: [
{ text: '\\(16\\sqrt{13}\\)', correct: false },
{ text: '\\(16\\sqrt{10}\\)', correct: true },
{ text: '\\(8\\sqrt{37}\\)', correct: false },
{ text: '\\(12\\sqrt{17}\\)', correct: false },
],
explanation: 'Ответ: \\(16\\sqrt{10}\\).',
},
{
topic: 'Статистика и диаграммы', difficulty: 1, year: 2021,
text: '[ЦТ 2021 · B1]\n\nПо диаграмме посещений сайта (вт≈400, ср≈440, чт≈260, пт≈280, сб≈640, вс≈650) установите соответствие:\n\nА) В какой день было на 20 посещений больше предыдущего?\nБ) В какой день — на 35% меньше вторника?\nВ) В какой день — на 10% больше предыдущего?',
options: [
{ text: 'А4Б3В2', correct: true },
{ text: 'А2Б3В4', correct: false },
{ text: 'А4Б2В3', correct: false },
{ text: 'А3Б4В2', correct: false },
],
explanation: 'А) пятница(+20 от чт)→4; Б) 400×0,65=260=чт→3; В) 400×1,1=440=ср→2. Ответ: А4Б3В2.',
},
{
topic: 'Тригонометрия', difficulty: 3, year: 2021, type: 'multiple',
text: '[ЦТ 2021 · B2]\n\nВыберите три верных утверждения:\n1) если \\(\\cos(\\arccos a)=\\cos(\\arccos\\tfrac{1}{18})\\), то \\(a=\\tfrac{1}{18}\\)\n2) если \\(\\cos a=-\\cos\\tfrac{\\pi}{18}\\), то \\(\\arccos(\\cos a)=-\\tfrac{\\pi}{18}\\)\n3) если \\(\\sin a=\\sin\\tfrac{17\\pi}{18}\\), то \\(\\arcsin(\\sin a)=\\tfrac{17\\pi}{18}\\)\n4) если \\(\\arccos a=\\tfrac{\\pi}{18}\\), то \\(a=\\cos\\tfrac{\\pi}{18}\\)\n5) если \\(\\sin a=\\sin\\tfrac{\\pi}{18}\\), то \\(a=-\\tfrac{\\pi}{18}\\)\n6) если \\(a=\\tfrac{\\pi}{18}\\) и \\(\\sin a=\\sin\\tfrac{\\pi}{18}\\), то \\(\\arcsin(\\sin a)=\\tfrac{\\pi}{18}\\)',
options: [
{ text: '1', correct: true },
{ text: '2', correct: false },
{ text: '3', correct: false },
{ text: '4', correct: true },
{ text: '5', correct: false },
{ text: '6', correct: true },
],
explanation: '1) ✓, 4) ✓ по определению arccos, 6) ✓ т.к. \\(\\tfrac{\\pi}{18}\\in[-\\tfrac{\\pi}{2};\\tfrac{\\pi}{2}]\\).',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021, type: 'multiple',
text: '[ЦТ 2021 · B3]\n\nПлоскости \\(\\alpha\\perp\\beta\\), пересекаются по \\(a\\), точка \\(A\\in\\beta\\). Выберите три верных утверждения:\n1) любая прямая через A, пересекающая α, пересекает a\n2) единственная прямая через A ⊥ α\n3) прямая через A ⊥ β тоже ⊥ α\n4) любая точка a ∈ α и β\n5) любая прямая в α ⊥ a тоже ⊥ β\n6) любая прямая ⊥ a принадлежит β',
options: [
{ text: '1', correct: true },
{ text: '2', correct: false },
{ text: '3', correct: false },
{ text: '4', correct: true },
{ text: '5', correct: true },
{ text: '6', correct: false },
],
explanation: '1) ✓, 4) ✓ — по определению линии пересечения, 5) ✓ — признак перпендикулярности плоскостей.',
},
{
topic: 'Словесные задачи', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · B4]\n\nНа пастбище (квадрат) загон для скота занимает \\(\\tfrac{1}{32}\\) площади пастбища. Найдите площадь загона (в м²), если по рисунку ширина пастбища связана с размером загона.',
options: [
{ text: '800', correct: true },
{ text: '640', correct: false },
{ text: '900', correct: false },
{ text: '1000', correct: false },
],
explanation: '\\(S_{\\text{паст}}=32\\cdot S_{\\text{загон}}\\). При \\(a^2=800\\): площадь загона = 800 м².',
},
{
topic: 'Арифметика и степени', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · B5]\n\nНайдите \\(\\sqrt{8}\\cdot\\sqrt[3]{-7}\\cdot\\sqrt{32}\\cdot\\sqrt[3]{49}-7\\cdot\\dfrac{\\sqrt[3]{64}}{-2}\\).',
options: [
{ text: '\\(-98\\)', correct: true },
{ text: '\\(-126\\)', correct: false },
{ text: '\\(-84\\)', correct: false },
{ text: '\\(-70\\)', correct: false },
],
explanation: '\\(\\sqrt{8}\\cdot\\sqrt{32}=16\\). \\(\\sqrt[3]{-7\\cdot49}=-7\\). Первое: \\(-112\\). Второе: \\(7\\cdot4/(-2)=-14\\). \\(-112-(-14)=-98\\).',
},
{
topic: 'Геометрия', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · B6]\n\nПлощадь боковой поверхности цилиндра \\(=15\\pi\\), радиус на 3,5 больше высоты. Найдите \\(\\dfrac{6V}{\\pi}\\).',
options: [
{ text: '225', correct: true },
{ text: '150', correct: false },
{ text: '300', correct: false },
{ text: '180', correct: false },
],
explanation: '\\(rh=7{,}5,\\;r=h+3{,}5\\Rightarrow h=1{,}5,\\;r=5\\). \\(V=37{,}5\\pi\\). \\(6V/\\pi=225\\).',
},
{
topic: 'Тригонометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B7]\n\nРешите \\(\\sqrt{3}\\cos\\!\\left(\\dfrac{5\\pi}{18}+\\pi x\\right)=-1{,}5\\). Найдите: 3 × наибольший корень на [3;9] × количество корней на [3;9].',
options: [
{ text: '160', correct: true },
{ text: '120', correct: false },
{ text: '200', correct: false },
{ text: '90', correct: false },
],
explanation: 'На [3;9]: 6 корней, \\(x_{\\max}=\\tfrac{80}{9}\\). Ответ: \\(3\\cdot\\tfrac{80}{9}\\cdot6=160\\).',
},
{
topic: 'Логарифмы', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B8]\n\nНайдите сумму всех целых решений \\(\\log_{0{,}3}\\log_{4{,}7}(2^{x+9{,}1}-1)\\ge0\\).',
options: [
{ text: '\\(-15\\)', correct: true },
{ text: '\\(-10\\)', correct: false },
{ text: '\\(-21\\)', correct: false },
{ text: '\\(-6\\)', correct: false },
],
explanation: 'Целые решения: \\(x=-8\\) и \\(x=-7\\). Сумма: \\(-15\\).',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B9]\n\n\\(AC\\) — общая гипотенуза прямоугольных треугольников \\(ABC\\) и \\(ADC\\), плоскости ⊥. \\(AB=9\\sqrt{3}\\), \\(BC=9\\sqrt{5}\\), \\(AD=DC\\). Найдите \\(BD^2\\).',
options: [
{ text: '324', correct: true },
{ text: '256', correct: false },
{ text: '400', correct: false },
{ text: '289', correct: false },
],
explanation: '\\(AC=18\\sqrt{2}\\), \\(AD=18\\). \\(BD^2=324\\).',
},
{
topic: 'Прогрессии', difficulty: 2, year: 2021,
text: '[ЦТ 2021 · B10]\n\n\\(a_n=2n^2-15n\\). Найдите наименьший член \\(a_m\\) и его номер \\(m\\). Запишите \\(m\\cdot a_m\\).',
options: [
{ text: '\\(-112\\)', correct: true },
{ text: '\\(-98\\)', correct: false },
{ text: '\\(-128\\)', correct: false },
{ text: '\\(-80\\)', correct: false },
],
explanation: '\\(a_4=-28\\) — минимум. \\(4\\times(-28)=-112\\).',
},
{
topic: 'Уравнения', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B11]\n\nНайдите \\(25\\cdot(x_1^2+x_2^2)\\), где \\(x_1,x_2\\) — корни уравнения \\(10\\sqrt{\\dfrac{x^2}{14+5x-x^2}}-2\\sqrt{\\dfrac{14+5x-x^2}{x^2}}=19\\).',
options: [
{ text: '960', correct: true },
{ text: '800', correct: false },
{ text: '1200', correct: false },
{ text: '750', correct: false },
],
explanation: '\\(t=2\\Rightarrow5x^2-20x-56=0\\). \\(x_1^2+x_2^2=\\tfrac{192}{5}\\). \\(25\\cdot\\tfrac{192}{5}=960\\).',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B12]\n\nПрямая через вершину \\(K\\) треугольника \\(KMN\\) делит медиану \\(MA\\) в отношении \\(8:3\\) от \\(M\\) и пересекает \\(MN\\) в точке \\(B\\). \\(S_{KMB}=16\\). Найдите \\(S_{KMN}\\).',
options: [
{ text: '28', correct: true },
{ text: '24', correct: false },
{ text: '32', correct: false },
{ text: '36', correct: false },
],
explanation: '\\(MB:BN=8:3\\Rightarrow MN/MB=11/8\\). \\(S_{KMN}=28\\).',
},
{
topic: 'Теория чисел', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B13]\n\nПетя записал два различных натуральных числа, сложил, перемножил, вычел меньшее из большего, разделил большее на меньшее. Сумма четырёх результатов = 1521. Найдите сумму всех таких пар.',
options: [
{ text: '460', correct: true },
{ text: '390', correct: false },
{ text: '520', correct: false },
{ text: '410', correct: false },
],
explanation: 'Пары: (108,12) и (338,2). Суммы: 120+340=460.',
},
{
topic: 'Геометрия', difficulty: 3, year: 2021,
text: '[ЦТ 2021 · B14]\n\nПирамида \\(SABCD\\): \\(AO=9\\), \\(OC=16\\), \\(BO=OD=12\\), диагонали ⊥. Вершина \\(S\\) удалена на \\(\\tfrac{61}{7}\\) от каждой стороны основания. Через середину высоты параллельно основанию проведена плоскость. Найдите \\(10\\cdot V_{\\text{большей части}}\\).',
options: [
{ text: '1375', correct: true },
{ text: '1250', correct: false },
{ text: '1500', correct: false },
{ text: '1100', correct: false },
],
explanation: '\\(S_{ABCD}=300\\), \\(h=\\tfrac{11}{7}\\), \\(V=\\tfrac{1100}{7}\\). Большая часть: \\(\\tfrac{1925}{14}\\). \\(10V=1375\\).',
},
];
/* ── Вставка (идемпотентно — пропускать уже существующие) ─────────────── */
let inserted = 0, skipped = 0;
const checkQ = db.prepare('SELECT id FROM questions WHERE subject_id=? AND text=?');
const insertQ = db.prepare(
'INSERT INTO questions (subject_id, topic_id, text, difficulty, year, explanation, type) VALUES (?,?,?,?,?,?,?)'
);
const insertO = db.prepare(
'INSERT INTO options (question_id, text, is_correct, order_index) VALUES (?,?,?,?)'
);
db.exec('BEGIN');
try {
for (const q of questions) {
if (checkQ.get(SID, q.text)) { skipped++; continue; }
const topicId = getOrCreateTopic(SID, q.topic);
const { lastInsertRowid: qid } = insertQ.run(
SID, topicId, q.text, q.difficulty,
q.year || null, q.explanation || null, q.type || 'single'
);
q.options.forEach((o, i) => insertO.run(qid, o.text, o.correct ? 1 : 0, i));
inserted++;
}
db.exec('COMMIT');
console.log(`✓ math: вставлено ${inserted}, пропущено ${skipped} (уже было).`);
} catch (err) {
db.exec('ROLLBACK');
console.error('Ошибка:', err.message);
process.exit(1);
}