This commit is contained in:
AZEN-SGG 2025-05-13 18:19:50 +03:00
parent 7393b9b49a
commit 896c925c11
19 changed files with 1102 additions and 0 deletions

View file

@ -0,0 +1,18 @@
FLAGS = -fstack-protector-all -W -Wall -Wextra -Wunused -Wcast-align -Werror -pedantic -pedantic-errors -Wfloat-equal -Wpointer-arith -Wformat-security -Wmissing-format-attribute -Wformat=1 -Wwrite-strings -Wcast-align -Wno-long-long -std=gnu99 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wold-style-definition -Wdeclaration-after-statement -Wbad-function-cast -Wnested-externs -O3
OBJ_COMMON = solve.o
NUMS = 1 2 3 4 5 6 7
OUTS = $(foreach n,$(NUMS),$(shell printf "a%02d.out\n" "$(n)"))
all: $(OUTS)
%.o: %.c
gcc -c $(FLAGS) $<
a%.out: a%.o $(OBJ_COMMON)
gcc $(FLAGS) $^ -o $@ -lm
clean:
rm -f *.o *.out

45
2025.05.09/dist/Krivoruchenko_SK/a01.c vendored Normal file
View file

@ -0,0 +1,45 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a01.out x h k */
int main (int argc, char *argv[])
{
double t, x, h, d;
int k, cls, task = 1;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 4) &&
sscanf(argv[1], "%lf", &x) == 1 &&
((sscanf(argv[2], "%lf", &h) == 1) && (h > 0)) &&
((sscanf(argv[3], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s x h k\n", argv[0]);
return -1;
}
t = clock();
d = t1_solve(f_lst[k], x, h);
t = (clock() - t) / CLOCKS_PER_SEC;
cls = get_call_count();
if (fabs(d - DBL_MAX) < DBL_EPSILON)
{
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, cls, t);
return -2;
} else
{
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, d, cls, t);
return 0;
}
}

45
2025.05.09/dist/Krivoruchenko_SK/a02.c vendored Normal file
View file

@ -0,0 +1,45 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a02.out x h k */
int main (int argc, char *argv[])
{
double t, x, h, d;
int k, cl, task = 2;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 4) &&
sscanf(argv[1], "%lf", &x) == 1 &&
((sscanf(argv[2], "%lf", &h) == 1) && (h > 0)) &&
((sscanf(argv[3], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s x h k\n", argv[0]);
return -1;
}
t = clock();
d = t2_solve(f_lst[k], x, h);
t = (clock() - t) / CLOCKS_PER_SEC;
cl = get_call_count();
if (fabs(d - DBL_MAX) < DBL_EPSILON)
{
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, cl, t);
return -2;
} else
{
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, d, cl, t);
return 0;
}
}

45
2025.05.09/dist/Krivoruchenko_SK/a03.c vendored Normal file
View file

@ -0,0 +1,45 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a03.out x h k */
int main (int argc, char *argv[])
{
double t, x, h, d;
int k, cl, task = 3;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 4) &&
sscanf(argv[1], "%lf", &x) == 1 &&
((sscanf(argv[2], "%lf", &h) == 1) && (h > 0)) &&
((sscanf(argv[3], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s x h k\n", argv[0]);
return -1;
}
t = clock();
d = t3_solve(f_lst[k], x, h);
t = (clock() - t) / CLOCKS_PER_SEC;
cl = get_call_count();
if (fabs(d - DBL_MAX) < DBL_EPSILON)
{
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, cl, t);
return -2;
} else
{
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, d, cl, t);
return 0;
}
}

44
2025.05.09/dist/Krivoruchenko_SK/a04.c vendored Normal file
View file

@ -0,0 +1,44 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a04.out a b n k */
int main (int argc, char *argv[])
{
double t, integral, a, b;
int k, n, calls, task = 4;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 5) &&
sscanf(argv[1], "%lf", &a) == 1 &&
sscanf(argv[2], "%lf", &b) == 1 &&
((sscanf(argv[3], "%d", &n) == 1) && (n > 0)) &&
((sscanf(argv[4], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s a b n k\n", argv[0]);
return -1;
}
t = clock();
integral = t4_solve(f_lst[k], a, b, n);
t = (clock() - t) / CLOCKS_PER_SEC;
calls = get_call_count();
if (fabs(integral - DBL_MAX) < DBL_EPSILON) {
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, calls, t);
return -2;
} else {
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, integral, calls, t);
return 0;
}
}

44
2025.05.09/dist/Krivoruchenko_SK/a05.c vendored Normal file
View file

@ -0,0 +1,44 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a05.out a b n k */
int main (int argc, char *argv[])
{
double t, integral, a, b;
int k, n, calls, task = 5;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 5) &&
sscanf(argv[1], "%lf", &a) == 1 &&
sscanf(argv[2], "%lf", &b) == 1 &&
((sscanf(argv[3], "%d", &n) == 1) && (n > 0)) &&
((sscanf(argv[4], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s a b n k\n", argv[0]);
return -1;
}
t = clock();
integral = t5_solve(f_lst[k], a, b, n);
t = (clock() - t) / CLOCKS_PER_SEC;
calls = get_call_count();
if (fabs(integral - DBL_MAX) < DBL_EPSILON) {
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, calls, t);
return -2;
} else {
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, integral, calls, t);
return 0;
}
}

44
2025.05.09/dist/Krivoruchenko_SK/a06.c vendored Normal file
View file

@ -0,0 +1,44 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a06.out a b n k */
int main (int argc, char *argv[])
{
double t, integral, a, b;
int k, n, calls, task = 6;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 5) &&
sscanf(argv[1], "%lf", &a) == 1 &&
sscanf(argv[2], "%lf", &b) == 1 &&
((sscanf(argv[3], "%d", &n) == 1) && (n > 0)) &&
((sscanf(argv[4], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s a b n k\n", argv[0]);
return -1;
}
t = clock();
integral = t6_solve(f_lst[k], a, b, n);
t = (clock() - t) / CLOCKS_PER_SEC;
calls = get_call_count();
if (fabs(integral - DBL_MAX) < DBL_EPSILON) {
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, calls, t);
return -2;
} else {
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, integral, calls, t);
return 0;
}
}

44
2025.05.09/dist/Krivoruchenko_SK/a07.c vendored Normal file
View file

@ -0,0 +1,44 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include "init_f.h"
#include "solve.h"
/* ./a07.out a b n k */
int main (int argc, char *argv[])
{
double t, integral, a, b;
int k, n, calls, task = 7;
double (*f_lst[]) (double) = {f0, f1, f2, f3, f4, f5, f6};
int len_f = sizeof(f_lst) / sizeof(f_lst[0]);
if (
!((argc == 5) &&
sscanf(argv[1], "%lf", &a) == 1 &&
sscanf(argv[2], "%lf", &b) == 1 &&
((sscanf(argv[3], "%d", &n) == 1) && (n > 0)) &&
((sscanf(argv[4], "%d", &k) == 1) && ((0 <= k) && (k < len_f))))
) {
fprintf(stderr, "Usage: %s a b n k\n", argv[0]);
return -1;
}
t = clock();
integral = t7_solve(f_lst[k], a, b, n);
t = (clock() - t) / CLOCKS_PER_SEC;
calls = get_call_count();
if (fabs(integral - DBL_MAX) < DBL_EPSILON) {
fprintf (stdout, "%s : Task = %d Method is not applicable Count = %d T = %.2f\n", argv[0], task, calls, t);
return -2;
} else {
fprintf (stdout, "%s : Task = %d Res = %e Count = %d T = %.2f\n", argv[0], task, integral, calls, t);
return 0;
}
}

50
2025.05.09/dist/Krivoruchenko_SK/comp.h vendored Normal file
View file

@ -0,0 +1,50 @@
#ifndef COMP_H
#define COMP_H
#include <float.h>
#include <math.h>
static inline double * fpmax (double *pa, double *pb, double fa, double fb, double *max_f_p)
{
if ((fa - fb) > DBL_EPSILON)
{
*max_f_p = fa;
return pa;
} else
{
*max_f_p = fb;
return pb;
}
}
static inline double * fp_abs_max (double *pa, double *pb, double *fa, double *fb, double **max_f_p)
{
if ((fabs(*fa) - fabs(*fb)) > DBL_EPSILON)
{
*max_f_p = fa;
return pa;
} else
{
*max_f_p = fb;
return pb;
}
}
static inline int is_equal (const double a, const double b)
{
double diff = a - b;
double max_val = (a > b) ? a : b;
return ((diff < 0) ? -diff : diff) < (DBL_EPSILON * max_val);
}
static inline int is_null (const double a)
{
return ((a < 0) ? -a : a) < DBL_EPSILON;
}
static inline int is_eps (const double a, const double eps)
{
return ((a < 0) ? -a : a) < eps;
}
#endif

View file

@ -0,0 +1,75 @@
#ifndef INIT_F_H
#define INIT_F_H
#include <math.h>
static inline double weight (double x)
{
return 1. / sqrt(fabs(x));
}
// ------------------------------------
static int cl = 0;
static inline int get_call_count (void)
{
return cl;
}
static inline double f0 (double x)
{
cl++;
(void)x;
return 1;
}
static inline double f1 (double x)
{
cl++;
return x + 1;
}
static inline double f2 (double x)
{
double x_2 = x * x;
cl++;
return x_2 + x + 1;
}
static inline double f3 (double x)
{
double x_2 = x * x;
double x_3 = x_2 * x;
cl++;
return x_3 + x_2 + x + 1;
}
static inline double f4 (double x)
{
double x_2 = x * x;
double x_3 = x_2 * x;
double x_4 = x_3 * x;
cl++;
return x_4 + x_3 + x_2 + x + 1;
}
static inline double f5 (double x)
{
cl++;
return exp(-x);
}
static inline double f6 (double x)
{
double x_2 = x * x;
cl++;
return 1 / (25 * x_2 + 1);
}
// ------------------------------------
#endif

148
2025.05.09/dist/Krivoruchenko_SK/solve.c vendored Normal file
View file

@ -0,0 +1,148 @@
#include "solve.h"
#include "comp.h"
#include <math.h>
#include <float.h>
double t1_solve (
double (*f) (double),
double x, double h
) {
if (h < NUM_FPE)
return DBL_MAX;
return (f(x + h) - f(x)) / h;
}
// -------
double t2_solve (
double (*f) (double),
double x, double h
) {
if (h < NUM_FPE)
return DBL_MAX;
return (f(x + h) - f(x - h)) / (2 * h);
}
// -------
double t3_solve (
double (*f) (double),
double x, double h
) {
double h_2 = h * h;
if (h_2 < NUM_FPE)
return DBL_MAX;
return (f(x + h) - 2 * f(x) + f(x - h)) / h_2;
}
// -------
double t4_solve (
double (*f) (double),
double a, double b,
int n
) {
const double h = (b - a) / n;
double x = a;
double sum = (f(a) + f(b)) * 0.5;
if (h < NUM_FPE)
return DBL_MAX;
for (int i = 1; i < (n - 1); ++i)
{
x += h;
sum += f(x);
}
return h * sum;
}
// -------
double t5_solve (
double (*f) (double),
double a, double b,
int n
) {
const double h = (b - a) / (2 * n);
double x = a;
double sum = (f(a) + f(b)) * 0.5;
if (h < NUM_FPE)
return DBL_MAX;
for (int i = 1; i < (2 * n - 1); ++i)
{
x += h;
sum += ((i & 1) + 1) * f(x);
}
return (b - a) * sum / (3 * n);
}
// -------
double t6_solve (
double (*f) (double),
double a, double b,
int n
) {
const double h = (b - a) / n;
double x = a;
double sum;
if (is_null(a) || is_null(b))
return DBL_MAX;
f_global = f;
sum = (wf(a) + wf(b)) * 0.5;
if (h < NUM_FPE)
return DBL_MAX;
for (int i = 1; i < (n - 1); ++i)
{
x += h;
if (is_null(x))
return DBL_MAX;
sum += wf(x);
}
return h * sum;
}
// -------
double t7_solve (
double (*f) (double),
double a, double b,
int n
) {
const double h = (b - a) / (2 * n);
double x = a;
double sum;
if (is_null(a) || is_null(b))
return DBL_MAX;
f_global = f;
sum = (wf(a) + wf(b)) * 0.5;
if (h < NUM_FPE)
return DBL_MAX;
for (int i = 1; i < (2 * n - 1); ++i)
{
x += h;
if (is_null(x))
return DBL_MAX;
sum += ((i & 1) + 1) * wf(x);
}
return (b - a) * sum / (3 * n);
}
// -------

View file

@ -0,0 +1,70 @@
#ifndef SOLVE_H
#define SOLVE_H
#define NUM_FPE 1e-300
#include "init_f.h"
#include <stddef.h>
double t1_solve (
double (*f) (double),
double x, double h
);
// -------
double t2_solve (
double (*f) (double),
double x, double h
);
// -------
double t3_solve (
double (*f) (double),
double x, double h
);
// -------
double t4_solve (
double (*f) (double),
double a, double b,
int n
);
// -------
double t5_solve (
double (*f) (double),
double a, double b,
int n
);
// -------
static double (*f_global)(double) = NULL;
static inline double wf (double x)
{
return f_global(x) * weight(x);
}
double t6_solve (
double (*f) (double),
double a, double b,
int n
);
// -------
double t7_solve (
double (*f) (double),
double a, double b,
int n
);
// -------
#endif

137
2025.05.09/tests/s2.sh Executable file
View file

@ -0,0 +1,137 @@
for stud in *_??
do
cd $stud
#echo > a01.txt
#echo > a02.txt
#echo > $studa03.txt
for tsk in a01 a02 a03
do
echo > ../$stud$tsk.txt
for x in -1 0 5 7
do
for ((k=0; k < 7; k = k + 1))
do
echo -n "$x 1e-5 $k " >> ../$stud$tsk.txt
./$tsk.out $x 1e-5 $k >> ../$stud$tsk.txt
echo -n "$x 1e-9 $k " >> ../$stud$tsk.txt
./$tsk.out $x 1e-9 $k >> ../$stud$tsk.txt
echo -n "$x 1e-12 $k " >> ../$stud$tsk.txt
./$tsk.out $x 1e-12 $k >> ../$stud$tsk.txt
done
done
done
for tsk in a04 a05 a06 a07
do
echo > ../$stud$tsk.txt
for AA in -5 -1 0 5 8
do
for BB in -5 -1 0 5 8
do
for NN in 0 3 5 7 10 100
do
for ((k=0; k < 7; k = k+1))
do
echo -n "$AA $BB $NN $k " >> ../$stud$tsk.txt
./$tsk.out $AA $BB $NN $k >> ../$stud$tsk.txt
done
done
done
done
done
echo "$stud 1-7"
for tsk in a08 a09
do
echo "$stud $tsk"
echo > ../$stud$tsk.txt
for AA in -5 -1 0 5 8
do
for BB in -5 -1 0 5 8
do
echo "A = $AA B = $BB"
for EP in 1e-2 1e-9 1e-17
do
for ((k=0; k < 7; k = k+1))
do
echo -n "$AA $BB $EP $k " >> ../$stud$tsk.txt
./$tsk.out $AA $BB $EP $k >> ../$stud$tsk.txt
echo $tsk: $AA $BB $EP $k
done
done
done
done
done
for tsk in a10 a11
do
echo "$stud $tsk"
echo > ../$stud$tsk.txt
for AA in -1 0 5 7
do
for EP in 1e-3 1e-7 1e-17
do
echo "$stud $tsk $AA $EP"
for ((k=0; k < 7; k = k + 1))
do
echo -n "$AA $EP $k " >> ../$stud$tsk.txt
./$tsk.out $AA $EP $k >> ../$stud$tsk.txt
echo $tsk: $AA $EP $k
done
done
done
done
tsk=a12
echo > ../$stud$tsk.txt
for AA in -5 0 8
do
for BB in -5 0 8
do
for EP in 1e-2 1e-7
do
echo "$stud $tsk $EP"
for ((kx=0;kx < 7; kx = kx+1))
do
for ((ky=0; ky < 7; ky = ky+1))
do
echo $tsk: $AA $BB $EP $kx $ky
echo -n " $AA $BB $EP $kx $ky " >> ../$stud$tsk.txt
./a12.out $AA $BB $EP $kx $ky >> ../$stud$tsk.txt
done
done
done
done
done
cd ..
done
for stud1 in *_??
do
for stud2 in *_??
do
echo > $stud1$stud2.txt
for tsk in a01 a02 a03 a04 a05 a06 a07 a08 a09 a10 a11 a12
do
echo "###################################################" >> $stud1$stud2.txt
echo "DIFF TSK = $tsk" >> $stud1$stud2.txt
diff $stud1$tsk.txt $stud2$tsk.txt >> $stud1$stud2.txt
echo "###################################################" >> $stud1$stud2.txt
done
done
done

159
2025.05.09/tests/test.sh Executable file
View file

@ -0,0 +1,159 @@
#!/bin/bash
chmod +x *.out
# Очищаем файл результатов
> res.txt
# Функция для вывода разделителя
print_separator() {
echo "=================" >> res.txt
}
# Функция для форматированного вывода входных данных
format_input() {
local task_num=$1
local line=($2)
case $task_num in
1|2|3)
echo "x=${line[0]} h=${line[1]} k=${line[2]}" >> res.txt
;;
4|5|6|7)
echo "a=${line[0]} b=${line[1]} n=${line[2]} k=${line[3]}" >> res.txt
;;
8|9)
echo "a=${line[0]} b=${line[1]} e=${line[2]} k=${line[3]}" >> res.txt
;;
10|11)
echo "a=${line[0]} e=${line[1]} k=${line[2]}" >> res.txt
;;
12)
echo "a=${line[0]} b=${line[1]} e=${line[2]} k1=${line[3]} k2=${line[4]}" >> res.txt
;;
esac
}
# Функция для запуска теста с обработкой ошибок
run_test() {
local task_num=$1
local line=$2
local binary="./a$(printf "%02d" $task_num).out"
# Проверяем существование исполняемого файла
if [ ! -f "$binary" ]; then
echo "Исполняемый файл $binary не найден!" >> res.txt
return 1
fi
# Запускаем программу и перехватываем ошибки
output=$(timeout 100s $binary $line 2>&1)
status=$?
case $status in
0)
# Успешное выполнение
echo "$output" >> res.txt
;;
136)
# Ошибка SEGFAULT (SIGSEGV)
format_input $task_num "$line"
echo "ОШИБКА: SEGFAULT (нарушение сегментации)" >> res.txt
;;
136|139)
# Ошибка SEGFAULT (SIGSEGV)
format_input $task_num "$line"
echo "ОШИБКА: SEGFAULT (нарушение сегментации)" >> res.txt
;;
8|136|137|139)
# FPE (SIGFPE) или другие сигналы
format_input $task_num "$line"
echo "ОШИБКА: FPE (ошибка вычисления с плавающей точкой)" >> res.txt
;;
124)
# Таймаут
format_input $task_num "$line"
echo "ОШИБКА: Таймаут выполнения (программа зависла)" >> res.txt
;;
*)
# Другие ошибки
format_input $task_num "$line"
echo "ОШИБКА: Программа завершилась с кодом $status" >> res.txt
;;
esac
}
# Запуск тестов для задач 1-3
for i in {1..3}; do
print_separator
echo "=== TASK $i ===" >> res.txt
print_separator
while read -r line || [[ -n "$line" ]]; do
[ -z "$line" ] && continue # Пропускаем пустые строки
format_input $i "$line"
run_test $i "$line"
echo "" >> res.txt # Добавляем пустую строку между тестами
done < tests1-3.txt
echo "" >> res.txt # Добавляем пустую строку между задачами
done
# Запуск тестов для задач 4-7
for i in {4..7}; do
print_separator
echo "=== TASK $i ===" >> res.txt
print_separator
while read -r line || [[ -n "$line" ]]; do
[ -z "$line" ] && continue
format_input $i "$line"
run_test $i "$line"
echo "" >> res.txt
done < tests4-7.txt
echo "" >> res.txt
done
# Запуск тестов для задач 8-9
for i in {8..9}; do
print_separator
echo "=== TASK $i ===" >> res.txt
print_separator
while read -r line || [[ -n "$line" ]]; do
[ -z "$line" ] && continue
format_input $i "$line"
run_test $i "$line"
echo "" >> res.txt
done < tests8-9.txt
echo "" >> res.txt
done
# Запуск тестов для задач 10-11
for i in {10..11}; do
print_separator
echo "=== TASK $i ===" >> res.txt
print_separator
while read -r line || [[ -n "$line" ]]; do
[ -z "$line" ] && continue
format_input $i "$line"
run_test $i "$line"
echo "" >> res.txt
done < tests10-11.txt
echo "" >> res.txt
done
# Запуск тестов для задачи 12
print_separator
echo "=== TASK 12 ===" >> res.txt
print_separator
while read -r line || [[ -n "$line" ]]; do
[ -z "$line" ] && continue
format_input 12 "$line"
run_test 12 "$line"
echo "" >> res.txt
done < tests12.txt

View file

@ -0,0 +1,21 @@
0 1e-8 0
0 1e-8 1
0 1e-8 2
0 1e-8 3
0 1e-8 4
0 1e-8 5
0 1e-8 6
-1 1e-8 0
-1 1e-8 1
-1 1e-8 2
-1 1e-8 3
-1 1e-8 4
-1 1e-8 5
-1 1e-8 6
1000 1e-8 0
1000 1e-8 1
1000 1e-8 2
1000 1e-8 3
1000 1e-8 4
1000 1e-8 5
1000 1e-8 6

View file

@ -0,0 +1,21 @@
-1 1e-7 0
-1 1e-7 1
-5 1e-7 2
0 1e-7 2
10 1e-7 2
-10 1e-7 2
-6 1e-7 3
0 1e-7 3
-3 1e-7 4
0 1e-7 4
10 1e-7 4
-10 1e-7 4
-4 1e-7 5
2 1e-7 5
10 1e-7 5
-9 1e-7 5
-10 1e-7 6
6 1e-7 6
-1 1e-7 6
-10 1e-7 6

View file

@ -0,0 +1,49 @@
-1 1 1e-6 0 0
-1 1 1e-6 0 1
-1 1 1e-6 0 2
-1 1 1e-6 0 3
-1 1 1e-6 0 4
-1 1 1e-6 0 5
-1 1 1e-6 0 6
-1 1 1e-6 1 0
-1 1 1e-6 1 1
-1 1 1e-6 1 2
-1 1 1e-6 1 3
-1 1 1e-6 1 4
-1 1 1e-6 1 5
-1 1 1e-6 1 6
-1 1 1e-6 2 0
-1 1 1e-6 2 1
-1 1 1e-6 2 2
-1 1 1e-6 2 3
-1 1 1e-6 2 4
-1 1 1e-6 2 5
-1 1 1e-6 2 6
-1 1 1e-6 3 0
-1 1 1e-6 3 1
-1 1 1e-6 3 2
-1 1 1e-6 3 3
-1 1 1e-6 3 4
-1 1 1e-6 3 5
-1 1 1e-6 3 6
-1 1 1e-6 4 0
-1 1 1e-6 4 1
-1 1 1e-6 4 2
-1 1 1e-6 4 3
-1 1 1e-6 4 4
-1 1 1e-6 4 5
-1 1 1e-6 4 6
-1 1 1e-6 5 0
-1 1 1e-6 5 1
-1 1 1e-6 5 2
-1 1 1e-6 5 3
-1 1 1e-6 5 4
-1 1 1e-6 5 5
-1 1 1e-6 5 6
-1 1 1e-6 6 0
-1 1 1e-6 6 1
-1 1 1e-6 6 2
-1 1 1e-6 6 3
-1 1 1e-6 6 4
-1 1 1e-6 6 5
-1 1 1e-6 6 6

View file

@ -0,0 +1,22 @@
-1 1 1000 0
1e99 1e101 1000 1
-1 1 1000 1
-5 0 1000 2
0 7 1000 2
10 100 1000 2
-10 100 1000 2
-6 -3 1000 3
0 10 1000 3
-3 0 1000 4
0 5 1000 4
10 100 1000 4
-10 9 1000 4
-4 -1 1000 5
2 5 1000 5
10 100 1000 5
-9 10 1000 5
-10 -7 1000 6
6 9 1000 6
-1 2 1000 6
-10 100 1000 6
0 100 100000 5

View file

@ -0,0 +1,21 @@
-1 1 1e-7 0
-1 1 1e-7 1
-5 0 1e-7 2
0 7 1e-7 2
10 100 1e-7 2
-10 100 1e-7 2
-6 -3 1e-7 3
0 10 1e-7 3
-3 0 1e-7 4
0 5 1e-7 4
10 100 1e-7 4
-10 9 1e-7 4
-4 -1 1e-7 5
2 5 1e-7 5
10 100 1e-7 5
-9 10 1e-7 5
-10 -7 1e-7 6
6 9 1e-7 6
-1 2 1e-7 6
-10 100 1e-7 6