buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> int main() { int a, b, c, d, e, f; double x, y, det; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { det = 1 / (double)(a * e - b * d); x = det * (double)(e * c - b * f); y = det * (double)(-d * c + a * f); printf("%f %f\n", x == 0 ? 0.0 : x, y == 0 ? 0.0 : y); } return 0; }
#include <stdio.h> int main() { int a, b, c, d, e, f; double x, y, det; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { det = 1 / (double)(a * e - b * d); x = det * (double)(e * c - b * f); y = det * (double)(-d * c + a * f); printf("%.3f %.3f\n", x == 0 ? 0.0 : x, y == 0 ? 0.0 : y); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
138
2
#include <stdio.h> int main() { int a, b, c, d, e, f, data[6]; double x, y, sum; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { data[0] = a * d; data[1] = b * d; data[2] = c * d; data[3] = d * a; data[4] = e * a; data[5] = f * a; y = data[1] - data[4]; sum = data[2] - data[5]; y = sum / y; x = (c - b * y) / a; printf("%f %f\n", x, y); } return 0; }
#include <stdio.h> int main() { int a, b, c, d, e, f, data[6]; double x, y, sum; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { data[0] = a * d; data[1] = b * d; data[2] = c * d; data[3] = d * a; data[4] = e * a; data[5] = f * a; y = data[1] - data[4]; sum = data[2] - data[5]; y = sum / y; x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
175
2
#include <stdio.h> int main(void) { int a, b, c, d, e, f; double x = 0, y = 0; while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF) { x = (double)(c * e - b * f) / (a * e - b * d); y = (double)(-d * c + a * f) / (a * e - b * d); if (x <= 0) x = 0; if (y <= 0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
#include <stdio.h> int main(void) { int a, b, c, d, e, f; double x = 0, y = 0; while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF) { x = (double)(c * e - b * f) / (a * e - b * d); y = (double)(-d * c + a * f) / (a * e - b * d); if (x == -0) x = 0; if (y == -0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
148
8
#include <stdio.h> int main() { int a, b, c, d, e, f; double x, y; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { if (b * d - a * e != 0) { y = (d * c - a * f) / (b * d - a * e); if (a != 0) { x = (c - b * y) / a; } else { x = (f - e * y) / d; } printf("%.3f %.3f\n", x, y); } else if (a * e - b * d == 0) { x = (e * c - b * f) / (a * e - b * d); if (b != 0) { y = (c - a * x) / b; } else { y = (f - d * x) / e; } } } return 0; }
#include <stdio.h> int main() { int a, b, c, d, e, f; double x, y; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { if (b * d - a * e != 0) { y = (double)(d * c - a * f) / (b * d - a * e); if (a != 0) { x = (c - b * y) / a; } else { x = (f - e * y) / d; } printf("%.3f %.3f\n", x, y); } else if (a * e - b * d == 0) { x = (double)(e * c - b * f) / (a * e - b * d); if (b != 0) { y = (c - a * x) / b; } else { y = (f - d * x) / e; } } } return 0; }
[["+", 0, 11, 12, 16, 31, 74, 39, 77, 39, 40], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 25], ["+", 0, 11, 12, 16, 31, 74, 51, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 74, 0, 24]]
0
215
6
#include <stdio.h> int main() { double a, b, c, d, e, f; double y, x; while (1) { scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f); if (getchar() == EOF) break; y = (c * d - f * a) / (b * d - e * a); x = (c - b * y) / a; printf("%.3f %.3f", x, y); } return 0; }
#include <stdio.h> int main() { double a, b, c, d, e, f; double y, x; while (1) { scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f); if (getchar() == EOF) break; y = (c * d - f * a) / (b * d - e * a); x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
115
1
#include <stdio.h> int main(void) { double a, b, c, d, e, f, x, y; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); x = (c - b * y) / a; x += 0.0005; y += 0.0005; x *= 1000; y *= 1000; x = floor(x); y = floor(y); x = x / 1000; y = y / 1000; printf("%.3lf %.3lf", x, y); } return 0; }
#include <stdio.h> int main(void) { double a, b, c, d, e, f, x, y; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); x = (c - b * y) / a; x += 0.0005; y += 0.0005; x *= 1000; y *= 1000; x = floor(x); y = floor(y); x = x / 1000; y = y / 1000; printf("%.3lf %.3lf\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
147
1
#include <stdio.h> double calcY(int a, int b, int c, int d, int e, int f) { return (double)((c * d - a * f) / (b * d - a * e)); } double calcX(int a, int b, int c, int d, int e, int f) { return (double)((c - b * calcY(a, b, c, d, e, f)) / a); } int main() { int a, b, c, d, e, f; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { printf("%.3lf %.3lf\n", calcX(a, b, c, d, e, f), calcY(a, b, c, d, e, f)); } return 0; }
#include <stdio.h> double calcY(int a, int b, int c, int d, int e, int f) { return (double)(c * d - a * f) / (b * d - a * e); } double calcX(int a, int b, int c, int d, int e, int f) { return (double)(c - b * calcY(a, b, c, d, e, f)) / a; } int main() { int a, b, c, d, e, f; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { printf("%.3lf %.3lf\n", calcX(a, b, c, d, e, f), calcY(a, b, c, d, e, f)); } return 0; }
[["-", 0, 74, 51, 23, 0, 16, 31, 23, 0, 24], ["-", 0, 74, 51, 23, 0, 16, 12, 23, 0, 25], ["-", 8, 9, 0, 37, 0, 74, 51, 23, 0, 24], ["-", 8, 9, 0, 37, 0, 74, 51, 23, 0, 25]]
0
194
4
#include <stdio.h> int main() { int num[6]; double ans[2]; while (scanf("%d %d %d %d %d %d", num, num + 1, num + 2, num + 3, num + 4, num + 5) != EOF) { if (((num[1] * num[3]) - (num[0] * num[4])) == 0) { //一意に解が求まらない } else { ans[0] = (((double)((num[1] * num[5]) - (num[4] * num[2]))) / ((double)((num[1] * num[3]) - (num[0] * num[4])))); // b == 0 if (num[1] == 0) { ans[1] = ((double)(num[5] - num[3] * ans[0])) / ((double)num[4]); } else { ans[1] = ((double)(num[2] - num[0] * ans[0])) / ((double)num[1]); } } if (ans[0] == 0) { ans[0] = 0.000; } if (ans[1] == 0) { ans[1] = 0.000; } printf("%.3lf, %.3lf\n", ans[0], ans[1]); } return 0; }
#include <stdio.h> int main() { int num[6]; double ans[2]; while (scanf("%d %d %d %d %d %d", num, num + 1, num + 2, num + 3, num + 4, num + 5) != EOF) { if (((num[1] * num[3]) - (num[0] * num[4])) == 0) { //一意に解が求まらない } else { ans[0] = (((double)((num[1] * num[5]) - (num[4] * num[2]))) / ((double)((num[1] * num[3]) - (num[0] * num[4])))); // b == 0 if (num[1] == 0) { ans[1] = ((double)(num[5] - num[3] * ans[0])) / ((double)num[4]); } else { ans[1] = ((double)(num[2] - num[0] * ans[0])) / ((double)num[1]); } } if (ans[0] == 0) { ans[0] = 0.000; } if (ans[1] == 0) { ans[1] = 0.000; } printf("%.3lf %.3lf\n", ans[0], ans[1]); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
306
2
#include <stdio.h> int main(void) { float a, b, c, d, e, f; float x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - d * b); x = (c - b * y) / a; printf("%.3f %3.f\n", x, y); } return (0); }
#include <stdio.h> int main(void) { float a, b, c, d, e, f; float x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - d * b); x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } return (0); }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
109
2
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); Arr.forEach(function(v) { var arr = v.split(" ").map(Number); var A = arr[0] * arr[4] - arr[3] * arr[1]; var B = arr[2] * arr[4] - arr[5] * arr[1]; var C = arr[0] * arr[5] - arr[3] * arr[2]; var x = (B / A).toFixed(4); var y = (C / A).toFixed(4); console.log(x + " " + y); });
var input = require('fs').readFileSync('/dev/stdin', 'utf8'); var Arr = (input.trim()).split("\n"); Arr.forEach(function(v) { var arr = v.split(" ").map(Number); var A = arr[0] * arr[4] - arr[3] * arr[1]; var B = arr[2] * arr[4] - arr[5] * arr[1]; var C = arr[0] * arr[5] - arr[3] * arr[2]; var x = (B / A).toFixed(3); var y = (C / A).toFixed(3); console.log(x + " " + y); });
[["-", 0, 198, 0, 200, 51, 2, 3, 3, 0, 555], ["+", 0, 198, 0, 200, 51, 2, 3, 3, 0, 555]]
2
178
4
process.stdin .on("data", function(c) { (c + "").trim().split("\n").some(function(n, x) { n = n.split(" "); var a = +n[0], b = +n[1], c = +n[2], d = +n[3], e = +n[4], f = +n[5], x; console.log((x = ((c * e - b * f) / (a * e - b * d))).toFixed(4), ((c - a * x) / b).toFixed(4)); }); }) .resume();
process.stdin .on("data", function(c) { (c + "").trim().split("\n").some(function(n, x) { n = n.split(" "); var a = +n[0], b = +n[1], c = +n[2], d = +n[3], e = +n[4], f = +n[5], x; console.log((x = ((c * e - b * f) / (a * e - b * d))).toFixed(3), ((c - a * x) / b).toFixed(3)); }); }) .resume();
[["-", 0, 2, 3, 3, 0, 2, 3, 3, 0, 555], ["+", 0, 2, 3, 3, 0, 2, 3, 3, 0, 555]]
2
167
4
<?php // ax + by = c // dx + ey = f function x($a, $b, $c, $y) { return ($c - ($b * $y)) / $a; } function y($a, $b, $c, $d, $e, $f) { return (($c * $d) - ($a * $f)) / (($b * $d) - ($a * $e)); } for (;fscanf(STDIN,"%d %d %d %d %d %d",$a,$b,$c,$d,$e,$f);) { $y = y($a, $b, $c, $d, $e, $f); $x = x($a, $b, $c, $y); printf("%.03f. %.03f" . PHP_EOL, $x, $y); }
<?php // ax + by = c // dx + ey = f function x($a, $b, $c, $y) { return ($c - ($b * $y)) / $a; } function y($a, $b, $c, $d, $e, $f) { return (($c * $d) - ($a * $f)) / (($b * $d) - ($a * $e)); } for (;fscanf(STDIN,"%d %d %d %d %d %d",$a,$b,$c,$d,$e,$f);) { $y = y($a, $b, $c, $d, $e, $f); $x = x($a, $b, $c, $y); printf("%.03f %.03f" . PHP_EOL, $x, $y); }
[["-", 3, 3, 0, 28, 0, 16, 31, 609, 0, 610], ["+", 3, 3, 0, 28, 0, 16, 31, 609, 0, 610]]
6
187
2
import java.math.BigDecimal; import java.util.Arrays; import java.util.Scanner; /** * Created by wintermaples on 2017/04/29. */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String read; while (scanner.hasNext()) { read = scanner.nextLine(); // 1????????????????????§int????????? int[] variables = Arrays.stream(read.split(" ")) .mapToInt(s -> Integer.parseInt(s)) .toArray(); //????????????????????????????????????????????°???????´? int a = variables[0]; int b = variables[1]; int c = variables[2]; int d = variables[3]; int e = variables[4]; int f = variables[5]; //?§£????????????????????¬?????§?????? double x = (c * e - b * f) / (a * e - b * d); double y = (a * f - c * d) / (a * e - b * d); BigDecimal xBD = new BigDecimal(x); BigDecimal yBD = new BigDecimal(y); xBD = xBD.setScale(3, BigDecimal.ROUND_HALF_UP); yBD = yBD.setScale(3, BigDecimal.ROUND_HALF_UP); // 3???????????¨???????????? System.out.println(String.format("%.3f", xBD) + " " + String.format("%.3f", yBD)); } } }
import java.math.BigDecimal; import java.util.Arrays; import java.util.Scanner; /** * Created by wintermaples on 2017/04/29. */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String read; while (scanner.hasNext()) { read = scanner.nextLine(); // 1????????????????????§int????????? int[] variables = Arrays.stream(read.split(" ")) .mapToInt(s -> Integer.parseInt(s)) .toArray(); //????????????????????????????????????????????°???????´? int a = variables[0]; int b = variables[1]; int c = variables[2]; int d = variables[3]; int e = variables[4]; int f = variables[5]; //?§£????????????????????¬?????§?????? double x = (double)(c * e - b * f) / (a * e - b * d); double y = (double)(a * f - c * d) / (a * e - b * d); BigDecimal xBD = new BigDecimal(x); BigDecimal yBD = new BigDecimal(y); xBD = xBD.setScale(3, BigDecimal.ROUND_HALF_UP); yBD = yBD.setScale(3, BigDecimal.ROUND_HALF_UP); // 3???????????¨???????????? System.out.println(String.format("%.3f", xBD) + " " + String.format("%.3f", yBD)); } } }
[["+", 49, 200, 51, 16, 31, 74, 39, 511, 0, 512], ["+", 0, 503, 49, 200, 51, 16, 31, 74, 0, 25], ["+", 49, 200, 51, 16, 31, 74, 51, 23, 0, 24], ["+", 0, 503, 49, 200, 51, 16, 31, 74, 0, 24]]
3
281
6
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Integer[] input = new Integer[6]; Scanner scan1 = new Scanner(System.in); while (scan1.hasNext()) { for (int i = 0; i < 6; i++) { input[i] = scan1.nextInt(); } int tmp = input[3] / input[0]; for (int i = 0; i < 3; i++) { input[i + 3] = input[i + 3] - input[i] * tmp; } double y = input[5] / input[4]; double x = (input[2] - (input[1] * y)) / input[0]; double x_ans = new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); double y_ans = new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); System.out.printf("%.3f ", x_ans); System.out.printf("%.3f", y_ans); System.out.println(""); } } }
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { double[] input = new double[6]; Scanner scan1 = new Scanner(System.in); while (scan1.hasNext()) { for (int i = 0; i < 6; i++) { input[i] = scan1.nextInt(); } double tmp = input[3] / input[0]; for (int i = 0; i < 3; i++) { input[i + 3] = input[i + 3] - (input[i] * tmp); } double y = input[5] / input[4]; double x = (input[2] - (input[1] * y)) / input[0]; double x_ans = new BigDecimal(x).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); double y_ans = new BigDecimal(y).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); System.out.printf("%.3f ", x_ans); System.out.printf("%.3f", y_ans); System.out.println(""); } } }
[["-", 0, 195, 8, 196, 0, 503, 39, 224, 468, 78], ["+", 8, 196, 0, 503, 39, 224, 468, 511, 0, 512], ["-", 8, 196, 0, 503, 49, 200, 51, 227, 39, 78], ["+", 0, 503, 49, 200, 51, 227, 39, 511, 0, 512], ["-", 0, 52, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 52, 8, 196, 0, 503, 39, 511, 0, 512], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
3
257
8
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextDouble()) { double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); double d = sc.nextDouble(); double e = sc.nextDouble(); double f = sc.nextDouble(); double x = (c * e - b * f) / (a * e - b * d); double y = (c * d - a * f) / (f * d - a * e); BigDecimal p = new BigDecimal(x); BigDecimal q = new BigDecimal(y); p = p.setScale(3, BigDecimal.ROUND_HALF_UP); q = q.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.printf("%.3f %.3f%n", p, q); } } }
import java.math.*; import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextDouble()) { double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); double d = sc.nextDouble(); double e = sc.nextDouble(); double f = sc.nextDouble(); double x = (c * e - b * f) / (a * e - b * d); double y = (c * d - a * f) / (b * d - a * e); BigDecimal p = new BigDecimal(x); BigDecimal q = new BigDecimal(y); p = p.setScale(3, BigDecimal.ROUND_HALF_UP); q = q.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.printf("%.3f %.3f%n", p, q); } } }
[["-", 51, 16, 12, 23, 0, 16, 31, 16, 31, 22], ["+", 51, 16, 12, 23, 0, 16, 31, 16, 31, 22]]
3
210
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * 0004:Simultaneous Equation * * @author Lyu * @version 2015/07/12 */ public class Main { /** 区切り文字:スペース */ protected static final String DELIMITER_SPACE = " "; /** * 連立方程式<br> * <p> * ax + by = c<br> * dx + ey = f * </p> * の解を出力する。 * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { List<String[]> dataSets = getInput(); for (int i = 0; i < dataSets.size(); ++i) { BigDecimal[] dataSet = toBigDecimalArray(dataSets.get(i)); System.out.println(getX(dataSet) + DELIMITER_SPACE + getY(dataSet)); } } private static BigDecimal getX(BigDecimal[] dataSet) { return dataSet[1] .multiply(dataSet[5]) .subtract(dataSet[2].multiply(dataSet[4])) .divide(dataSet[1] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[4])), 4, BigDecimal.ROUND_HALF_UP); } private static BigDecimal getY(BigDecimal[] dataSet) { return dataSet[2] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[5])) .divide(dataSet[1] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[4])), 4, BigDecimal.ROUND_HALF_UP); } /** * String型の配列をBigDecimal型の配列に変換する。 * * @param stringArray * 変換対象のString型配列 */ private static BigDecimal[] toBigDecimalArray(String[] stringArray) { BigDecimal[] bigDecimalArray = new BigDecimal[stringArray.length]; for (int i = 0; i < stringArray.length; ++i) { bigDecimalArray[i] = new BigDecimal(stringArray[i]); } return bigDecimalArray; } /** * 標準入力を読み取る。<br> * データセットの各行は、区切り文字により分割した配列としてリストに格納する。 * * @return データセットの各行を格納したリスト * @throws IOException */ protected static List<String[]> getInput() throws IOException { // 入力読取り InputStreamReader streamReader = new InputStreamReader(System.in); BufferedReader bufferedReader = new BufferedReader(streamReader); List<String[]> dataSets = new ArrayList<String[]>(); String line = null; try { while ((line = bufferedReader.readLine()) != null) { String[] dataSet = line.split(DELIMITER_SPACE); dataSets.add(dataSet); } return dataSets; } finally { bufferedReader.close(); streamReader.close(); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * 0004:Simultaneous Equation * * @author Lyu * @version 2015/07/12 */ public class Main { /** 区切り文字:スペース */ protected static final String DELIMITER_SPACE = " "; /** * 連立方程式<br> * <p> * ax + by = c<br> * dx + ey = f * </p> * の解を出力する。 * * @param args * @throws IOException */ public static void main(String[] args) throws IOException { List<String[]> dataSets = getInput(); for (int i = 0; i < dataSets.size(); ++i) { BigDecimal[] dataSet = toBigDecimalArray(dataSets.get(i)); System.out.println(getX(dataSet) + DELIMITER_SPACE + getY(dataSet)); } } private static BigDecimal getX(BigDecimal[] dataSet) { return dataSet[1] .multiply(dataSet[5]) .subtract(dataSet[2].multiply(dataSet[4])) .divide(dataSet[1] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[4])), 3, BigDecimal.ROUND_HALF_UP); } private static BigDecimal getY(BigDecimal[] dataSet) { return dataSet[2] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[5])) .divide(dataSet[1] .multiply(dataSet[3]) .subtract(dataSet[0].multiply(dataSet[4])), 3, BigDecimal.ROUND_HALF_UP); } /** * String型の配列をBigDecimal型の配列に変換する。 * * @param stringArray * 変換対象のString型配列 */ private static BigDecimal[] toBigDecimalArray(String[] stringArray) { BigDecimal[] bigDecimalArray = new BigDecimal[stringArray.length]; for (int i = 0; i < stringArray.length; ++i) { bigDecimalArray[i] = new BigDecimal(stringArray[i]); } return bigDecimalArray; } /** * 標準入力を読み取る。<br> * データセットの各行は、区切り文字により分割した配列としてリストに格納する。 * * @return データセットの各行を格納したリスト * @throws IOException */ protected static List<String[]> getInput() throws IOException { // 入力読取り InputStreamReader streamReader = new InputStreamReader(System.in); BufferedReader bufferedReader = new BufferedReader(streamReader); List<String[]> dataSets = new ArrayList<String[]>(); String line = null; try { while ((line = bufferedReader.readLine()) != null) { String[] dataSet = line.split(DELIMITER_SPACE); dataSets.add(dataSet); } return dataSets; } finally { bufferedReader.close(); streamReader.close(); } } }
[["-", 8, 196, 0, 37, 0, 492, 3, 4, 0, 499], ["+", 8, 196, 0, 37, 0, 492, 3, 4, 0, 499]]
3
479
4
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] c = new int[6]; double x, y; BigDecimal outX, outY; while (scan.hasNext()) { for (int i = 0; i < c.length; i++) { c[i] = scan.nextInt(); } if (c[0] == 0) { y = c[2] / (double)c[1]; x = (c[5] - c[4] * y) == 0 ? 0.000 : (c[5] - c[4] * y) / (double)c[3]; } else if (c[1] == 0) { x = c[2] / (double)c[0]; y = (c[5] - c[3] * x) == 0 ? 0.000 : (c[5] - c[3] * x) / (double)c[4]; } else if (c[3] == 0) { y = c[5] / (double)c[4]; x = (c[2] - c[1] * y) == 0 ? 0.000 : (c[2] - c[1] * y) / (double)c[0]; } else if (c[4] == 0) { x = c[5] / (double)c[3]; y = (c[2] - c[0] * x) == 0 ? 0.000 : (c[2] - c[0] * x) / (double)c[1]; } else { x = (c[4] * c[2] - c[1] * c[5]) == 0 ? 0.000 : (c[4] * c[2] - c[1] * c[5]) / (double)(c[4] * c[0] - c[1] * c[3]); y = (c[2] * c[3] - c[0] * c[5]) == 0 ? 0.000 : (c[2] * c[3] - c[0] * c[5]) / (double)(c[1] * c[3] - c[0] * c[4]); } outX = new BigDecimal(String.valueOf(x)) .setScale(3, BigDecimal.ROUND_HALF_UP); ; outY = new BigDecimal(String.valueOf(y)) .setScale(3, BigDecimal.ROUND_HALF_UP); ; System.out.printf("%.3f %.3f", outX.doubleValue(), outY.doubleValue()); } scan.close(); } }
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] c = new int[6]; double x, y; BigDecimal outX, outY; while (scan.hasNext()) { for (int i = 0; i < c.length; i++) { c[i] = scan.nextInt(); } if (c[0] == 0) { y = c[2] / (double)c[1]; x = (c[5] - c[4] * y) == 0 ? 0.000 : (c[5] - c[4] * y) / (double)c[3]; } else if (c[1] == 0) { x = c[2] / (double)c[0]; y = (c[5] - c[3] * x) == 0 ? 0.000 : (c[5] - c[3] * x) / (double)c[4]; } else if (c[3] == 0) { y = c[5] / (double)c[4]; x = (c[2] - c[1] * y) == 0 ? 0.000 : (c[2] - c[1] * y) / (double)c[0]; } else if (c[4] == 0) { x = c[5] / (double)c[3]; y = (c[2] - c[0] * x) == 0 ? 0.000 : (c[2] - c[0] * x) / (double)c[1]; } else { x = (c[4] * c[2] - c[1] * c[5]) == 0 ? 0.000 : (c[4] * c[2] - c[1] * c[5]) / (double)(c[4] * c[0] - c[1] * c[3]); y = (c[2] * c[3] - c[0] * c[5]) == 0 ? 0.000 : (c[2] * c[3] - c[0] * c[5]) / (double)(c[1] * c[3] - c[0] * c[4]); } outX = new BigDecimal(String.valueOf(x)) .setScale(3, BigDecimal.ROUND_HALF_UP); ; outY = new BigDecimal(String.valueOf(y)) .setScale(3, BigDecimal.ROUND_HALF_UP); ; System.out.printf("%.3f %.3f\n", outX.doubleValue(), outY.doubleValue()); } scan.close(); } }
[["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
605
1
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner s = new Scanner(System.in); int a, b, c, d, e, f; String str; double x, y; while (s.hasNext()) { a = s.nextInt(); b = s.nextInt(); c = s.nextInt(); d = s.nextInt(); e = s.nextInt(); f = s.nextInt(); y = (c * d - f * a) / (b * d - e * a); x = (c - b * y) / a; System.out.printf("%.3f %.3f\n", x, y); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO ????????????????????????????????????????????? Scanner s = new Scanner(System.in); double a, b, c, d, e, f; double x, y; while (s.hasNext()) { a = s.nextInt(); b = s.nextInt(); c = s.nextInt(); d = s.nextInt(); e = s.nextInt(); f = s.nextInt(); y = (c * d - f * a) / (b * d - e * a); x = (c - b * y) / a; System.out.printf("%.3f %.3f\n", x, y); } } }
[["-", 0, 195, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 195, 8, 196, 0, 503, 39, 511, 0, 512], ["-", 8, 498, 0, 195, 8, 196, 0, 503, 0, 35], ["-", 8, 498, 0, 195, 8, 196, 0, 503, 39, 78], ["-", 0, 195, 8, 196, 0, 503, 49, 200, 141, 22]]
3
165
5
import java.util.LinkedList; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String input; LinkedList<String> output = new LinkedList<String>(); double[] p = new double[6]; // 0a 1b 2c 3d 4e 5f double a, b, c, d, e, f; while (in.hasNext()) { for (int i = 0; i < p.length; i++) { p[i] = in.nextDouble(); } a = p[0]; b = p[1]; c = p[2]; d = p[3]; e = p[4]; f = p[5]; double y = (c * d - a * f) / (b * d - a * e); double x = (c * e - b * f) / (a * e - b * d); if (x == -0.0) { x = 0.0; } if (y == 0.0) { y = 0.0; } output.add(String.format("%.3f %.3f\n", x, y)); } for (int i = 0; i < output.size(); i++) { System.out.println(output.get(i)); } } }
import java.util.LinkedList; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String input; LinkedList<String> output = new LinkedList<String>(); double[] p = new double[6]; // 0a 1b 2c 3d 4e 5f double a, b, c, d, e, f; while (in.hasNext()) { for (int i = 0; i < p.length; i++) { p[i] = in.nextDouble(); } a = p[0]; b = p[1]; c = p[2]; d = p[3]; e = p[4]; f = p[5]; double y = (c * d - a * f) / (b * d - a * e); double x = (c * e - b * f) / (a * e - b * d); if (x == -0.0) { x = 0.0; } if (y == 0.0) { y = 0.0; } output.add(String.format("%.3f %.3f", x, y)); } for (int i = 0; i < output.size(); i++) { System.out.println(output.get(i)); } } }
[["-", 3, 4, 0, 492, 3, 4, 0, 5, 0, 44]]
3
288
1
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = br.readLine()) != null) { String[] str2 = str.split(" "); double a = Double.parseDouble(str2[0]); double b = Double.parseDouble(str2[1]); double c = Double.parseDouble(str2[2]); double d = Double.parseDouble(str2[3]); double e = Double.parseDouble(str2[4]); double f = Double.parseDouble(str2[5]); double x = (c * e - b * f) / (a * e - b * d); double y = (c * d - a * f) / (b * d - a * e); BigDecimal bdY = new BigDecimal(y); BigDecimal bdX = new BigDecimal(x); bdY = bdY.setScale(3, BigDecimal.ROUND_HALF_UP); bdX = bdX.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.printf("%.3f %.3f", bdX, bdY); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = br.readLine()) != null) { String[] str2 = str.split(" "); double a = Double.parseDouble(str2[0]); double b = Double.parseDouble(str2[1]); double c = Double.parseDouble(str2[2]); double d = Double.parseDouble(str2[3]); double e = Double.parseDouble(str2[4]); double f = Double.parseDouble(str2[5]); double x = (c * e - b * f) / (a * e - b * d); double y = (c * d - a * f) / (b * d - a * e); BigDecimal bdY = new BigDecimal(y); BigDecimal bdX = new BigDecimal(x); bdY = bdY.setScale(3, BigDecimal.ROUND_HALF_UP); bdX = bdX.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.printf("%.3f %.3f\n", bdX, bdY); } } }
[["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
277
1
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<String> ans = new ArrayList<>(); while (sc.hasNext()) { double[] a = {sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble()}; ans.add(String.format("%.3f %.3f", getX(a), getY(a))); } for (int i = 0, size = ans.size(); i < size; i++) { System.out.println(ans.get(i)); } } static double getX(double[] v) { double x1 = v[0] * Math.abs(v[4]); double c1 = v[2] * Math.abs(v[4]); double x2 = v[3] * Math.abs(v[1]); double c2 = v[5] * Math.abs(v[1]); if ((v[1] >= 0) == (v[4] >= 0)) { x2 *= -1; c2 *= -1; } return (c1 + c2) / (x1 + x2); } static double getY(double[] v) { double y1 = v[1] * Math.abs(v[3]); double c1 = v[2] * Math.abs(v[3]); double y2 = v[4] * Math.abs(v[0]); double c2 = v[5] * Math.abs(v[0]); if ((v[1] >= 0) == (v[4] >= 0)) { y2 *= -1; c2 *= -1; } return (c1 + c2) / (y1 + y2); } }
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); ArrayList<String> ans = new ArrayList<String>(); while (sc.hasNext()) { double[] a = {sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble()}; ans.add(String.format("%.3f %.3f", getX(a), getY(a))); } for (int i = 0, size = ans.size(); i < size; i++) { System.out.println(ans.get(i)); } } static double getX(double[] v) { double x1 = v[0] * Math.abs(v[4]); double c1 = v[2] * Math.abs(v[4]); double x2 = v[3] * Math.abs(v[1]); double c2 = v[5] * Math.abs(v[1]); if ((v[1] >= 0) == (v[4] >= 0)) { x2 *= -1; c2 *= -1; } return (c1 + c2) / (x1 + x2); } static double getY(double[] v) { double y1 = v[1] * Math.abs(v[3]); double c1 = v[2] * Math.abs(v[3]); double y2 = v[4] * Math.abs(v[0]); double c2 = v[5] * Math.abs(v[0]); if ((v[0] >= 0) == (v[3] >= 0)) { y2 *= -1; c2 *= -1; } return (c1 + c2) / (y1 + y2); } }
[["+", 49, 200, 51, 230, 39, 513, 0, 237, 0, 78], ["-", 0, 16, 31, 23, 0, 16, 31, 504, 71, 499], ["+", 0, 16, 31, 23, 0, 16, 31, 504, 71, 499], ["-", 0, 16, 12, 23, 0, 16, 31, 504, 71, 499], ["+", 0, 16, 12, 23, 0, 16, 31, 504, 71, 499]]
3
418
5
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in); public static void main(String[] args) { while (scan.hasNext()) { double a = scan.nextDouble(); double b = scan.nextDouble(); double c = scan.nextDouble(); double d = scan.nextDouble(); double e = scan.nextDouble(); double f = scan.nextDouble(); double x, y; y = (f * a + d * c) / (d * b + e * a); x = (f * b - e * c) / (b * d - e * a); if (x == 0) x = 0.; if (y == 0) y = 0.; System.out.printf("%.3f %.3f\n", x, y); } } }
import java.util.*; public class Main { private static final Scanner scan = new Scanner(System.in); public static void main(String[] args) { while (scan.hasNext()) { double a = scan.nextDouble(); double b = scan.nextDouble(); double c = scan.nextDouble(); double d = scan.nextDouble(); double e = scan.nextDouble(); double f = scan.nextDouble(); double x, y; y = (f * a - d * c) / (-d * b + e * a); x = (f * b - e * c) / (b * d - e * a); if (x == 0) x = 0.; if (y == 0) y = 0.; System.out.printf("%.3f %.3f\n", x, y); } } }
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 31, 16, 31, 91, 17, 33]]
3
187
3
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int a = Integer.parseInt(sc.next()); int b = Integer.parseInt(sc.next()); int c = Integer.parseInt(sc.next()); int d = Integer.parseInt(sc.next()); int e = Integer.parseInt(sc.next()); int f = Integer.parseInt(sc.next()); double x = (c * e - b * f) / (a * e - b * d); double y = (c - a * x) / b; if (x == 0.0) { x = 0.0; } if (y == 0.0) { y = 0.0; } System.out.printf("%4.3f %4.3f\n", x, y); } } }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double a = Integer.parseInt(sc.next()); double b = Integer.parseInt(sc.next()); double c = Integer.parseInt(sc.next()); double d = Integer.parseInt(sc.next()); double e = Integer.parseInt(sc.next()); double f = Integer.parseInt(sc.next()); double x = (c * e - b * f) / (a * e - b * d); double y = (c - a * x) / b; if (x == 0.0) { x = 0.0; } if (y == 0.0) { y = 0.0; } System.out.printf("%4.3f %4.3f\n", x, y); } } }
[["-", 0, 52, 8, 196, 0, 503, 39, 506, 0, 507], ["+", 0, 52, 8, 196, 0, 503, 39, 511, 0, 512]]
3
205
12
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String argv[]) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String str; String Array[] = new String[6]; double a, b, c, d, e, f, x, y; while ((str = br.readLine()) != null) { Array = str.split(" "); a = Double.parseDouble(Array[0]); b = Double.parseDouble(Array[1]); c = Double.parseDouble(Array[2]); d = Double.parseDouble(Array[3]); e = Double.parseDouble(Array[4]); f = Double.parseDouble(Array[5]); y = (c * d / a - f) / ((b * d / a) - e); x = (c / a - b * y / a); System.out.printf("%.4f %.4f\n", x, y); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String argv[]) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); String str; String Array[] = new String[6]; double a, b, c, d, e, f, x, y; while ((str = br.readLine()) != null) { Array = str.split(" "); a = Double.parseDouble(Array[0]); b = Double.parseDouble(Array[1]); c = Double.parseDouble(Array[2]); d = Double.parseDouble(Array[3]); e = Double.parseDouble(Array[4]); f = Double.parseDouble(Array[5]); y = (c * d / a - f) / ((b * d / a) - e); x = (c / a - b * y / a); System.out.printf("%.3f %.3f\n", x, y); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
244
2
import java.math.BigDecimal; import java.util.Scanner; public class Main { static Scanner sc = new java.util.Scanner(System.in); public static void main(String[] args) { int[] con = new int[6]; while (sc.hasNext()) { for (int i = 0; i < 6; i++) { con[i] = sc.nextInt(); } double x = 0; double y = 0; x = (con[2] * con[4] - con[1] * con[5]) / (con[0] * con[4] - con[1] * con[3]); y = (con[2] * con[3] - con[0] * con[5]) / (con[1] * con[3] - con[0] * con[4]); BigDecimal xx = new BigDecimal(x); BigDecimal yy = new BigDecimal(y); xx = xx.setScale(3, BigDecimal.ROUND_HALF_UP); yy = yy.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.println(xx + " " + yy); } } }
import java.math.BigDecimal; import java.util.Scanner; public class Main { static Scanner sc = new java.util.Scanner(System.in); public static void main(String[] args) { double[] con = new double[6]; while (sc.hasNext()) { for (int i = 0; i < 6; i++) { con[i] = sc.nextInt(); } double x = 0; double y = 0; x = (con[2] * con[4] - con[1] * con[5]) / (con[0] * con[4] - con[1] * con[3]); y = (con[2] * con[3] - con[0] * con[5]) / (con[1] * con[3] - con[0] * con[4]); BigDecimal xx = new BigDecimal(x); BigDecimal yy = new BigDecimal(y); xx = xx.setScale(3, BigDecimal.ROUND_HALF_UP); yy = yy.setScale(3, BigDecimal.ROUND_HALF_UP); System.out.println(xx + " " + yy); } } }
[["-", 8, 196, 0, 503, 39, 224, 468, 506, 0, 507], ["+", 8, 196, 0, 503, 39, 224, 468, 511, 0, 512], ["-", 0, 503, 49, 200, 51, 227, 39, 506, 0, 507], ["+", 0, 503, 49, 200, 51, 227, 39, 511, 0, 512]]
3
256
4
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); List<String> datasets = new ArrayList<>(); String dataset; double x, y, ad_bc; try { while ((dataset = br.readLine()) != null) { datasets.add(dataset); } } catch (IOException e) { e.printStackTrace(); } for (String eachLine : datasets) { String[] eachStr = eachLine.split(" "); int[] each = new int[eachStr.length]; for (int i = 0; i < eachStr.length; i++) { each[i] = Integer.parseInt(eachStr[i]); } ad_bc = each[0] * each[4] - each[1] * each[3]; x = (each[4] / ad_bc * each[2]) + (-each[1] / ad_bc * each[5]); y = (-each[3] / ad_bc * each[2]) + (each[0] / ad_bc * each[5]); BigDecimal bx = new BigDecimal(x); BigDecimal by = new BigDecimal(y); System.out.print(bx.setScale(3, BigDecimal.ROUND_HALF_UP) + " " + by.setScale(3, BigDecimal.ROUND_HALF_UP)); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; class Main { public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); List<String> datasets = new ArrayList<>(); String dataset; double x, y, ad_bc; try { while ((dataset = br.readLine()) != null) { datasets.add(dataset); } } catch (IOException e) { e.printStackTrace(); } for (String eachLine : datasets) { String[] eachStr = eachLine.split(" "); int[] each = new int[eachStr.length]; for (int i = 0; i < eachStr.length; i++) { each[i] = Integer.parseInt(eachStr[i]); } ad_bc = each[0] * each[4] - each[1] * each[3]; x = (each[4] / ad_bc * each[2]) + (-each[1] / ad_bc * each[5]); y = (-each[3] / ad_bc * each[2]) + (each[0] / ad_bc * each[5]); BigDecimal bx = new BigDecimal(x); BigDecimal by = new BigDecimal(y); System.out.println(bx.setScale(3, BigDecimal.ROUND_HALF_UP) + " " + by.setScale(3, BigDecimal.ROUND_HALF_UP)); } } }
[["-", 0, 514, 8, 196, 0, 1, 0, 492, 141, 22], ["+", 0, 514, 8, 196, 0, 1, 0, 492, 141, 22]]
3
339
2
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; double[] ans = new double[2]; double det = 0; while ((str = br.readLine()) != null) { String[] aa = str.split(" "); double[] a = new double[aa.length]; for (int i = 0; i < aa.length; i++) { a[i] = Double.parseDouble(aa[i]); } det = a[0] * a[4] - a[1] * a[3]; ans[0] = (a[4] * a[2] - a[1] * a[5]) / det; ans[1] = (-a[3] * a[2] + a[0] * a[5]) / det; for (int i = 0; i < 2; i++) { if (ans[i] == 0) { ans[i] = 0; } } System.out.printf("%.3f %.3f", ans[0], ans[1]); } } }
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; double[] ans = new double[2]; double det = 0; while ((str = br.readLine()) != null) { String[] aa = str.split(" "); double[] a = new double[aa.length]; for (int i = 0; i < aa.length; i++) { a[i] = Double.parseDouble(aa[i]); } det = a[0] * a[4] - a[1] * a[3]; ans[0] = (a[4] * a[2] - a[1] * a[5]) / det; ans[1] = (-a[3] * a[2] + a[0] * a[5]) / det; for (int i = 0; i < 2; i++) { if (ans[i] == 0) { ans[i] = 0; } } System.out.printf("%.3f %.3f\n", ans[0], ans[1]); } } }
[["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
285
1
import java.io.*; import java.util.*; public class Main { static IO io = new IO(); public static void main(String[] args) { double a, b, c, d, e, f; double x = 0; double y = 0; while (io.hasNext()) { a = io.nextInt(); b = io.nextInt(); c = io.nextInt(); d = io.nextInt(); e = io.nextInt(); f = io.nextInt(); x = Math.round(1000 * (c * e - b * f) / (a * e - b * d)) / 1000; y = Math.round(1000 * (c * d - a * f) / (b * d - a * e)) / 1000; System.out.printf("%.3f %.3f\n", x, y); } } static class IO extends PrintWriter { private final InputStream in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; IO() { this(System.in); } IO(InputStream source) { super(System.out); this.in = source; } boolean hasNextByte() { if (ptr < buflen) return true; else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) return false; } return true; } int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } boolean hasNext() { skipUnprintable(); return hasNextByte(); } long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) throw new NumberFormatException(); while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n; else throw new NumberFormatException(); b = readByte(); } } int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public void close() { super.close(); try { in.close(); } catch (IOException ignored) { } } } }
import java.io.*; import java.util.*; public class Main { static IO io = new IO(); public static void main(String[] args) { double a, b, c, d, e, f; double x = 0; double y = 0; while (io.hasNext()) { a = io.nextInt(); b = io.nextInt(); c = io.nextInt(); d = io.nextInt(); e = io.nextInt(); f = io.nextInt(); x = Math.round(1000 * (c * e - b * f) / (a * e - b * d)) / 1000.0; y = Math.round(1000 * (c * d - a * f) / (b * d - a * e)) / 1000.0; System.out.printf("%.3f %.3f\n", x, y); } } static class IO extends PrintWriter { private final InputStream in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; IO() { this(System.in); } IO(InputStream source) { super(System.out); this.in = source; } boolean hasNextByte() { if (ptr < buflen) return true; else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) return false; } return true; } int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } void skipUnprintable() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; } boolean hasNext() { skipUnprintable(); return hasNextByte(); } long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) throw new NumberFormatException(); while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) return minus ? -n : n; else throw new NumberFormatException(); b = readByte(); } } int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int)nl; } public void close() { super.close(); try { in.close(); } catch (IOException ignored) { } } } }
[["-", 8, 196, 0, 1, 0, 11, 12, 16, 12, 499], ["+", 8, 196, 0, 1, 0, 11, 12, 16, 12, 515]]
3
608
4
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int[] nums = new int[6]; final int a = 0; final int b = 1; final int c = 2; final int d = 3; final int e = 4; final int f = 5; while (stdin.hasNextInt()) { for (int i = 0; i < 6; i++) { nums[i] = stdin.nextInt(); } double y = (nums[d] * nums[c] - nums[a] * nums[f]) / (nums[d] * nums[b] - nums[a] * nums[e]); double x = (nums[c] - nums[b] * y) / nums[a]; System.out.printf("%.3f %.3f\n", x, y); } } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int[] nums = new int[6]; final int a = 0; final int b = 1; final int c = 2; final int d = 3; final int e = 4; final int f = 5; while (stdin.hasNextInt()) { for (int i = 0; i < 6; i++) { nums[i] = stdin.nextInt(); } double y = (double)(nums[d] * nums[c] - nums[a] * nums[f]) / (nums[d] * nums[b] - nums[a] * nums[e]); double x = (nums[c] - nums[b] * y) / nums[a]; System.out.printf("%.3f %.3f\n", x, y); } } }
[["+", 49, 200, 51, 16, 31, 74, 39, 511, 0, 512], ["+", 0, 503, 49, 200, 51, 16, 31, 74, 0, 25], ["+", 49, 200, 51, 16, 31, 74, 51, 23, 0, 24]]
3
203
3
import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = null; stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in))); double[][] x = new double[10000][6]; int i = 0; while (stdIn.hasNext()) { if (stdIn.hasNextDouble()) { for (int j = 0; j < 6; j++) { x[i][j] = stdIn.nextDouble(); } } else { stdIn.next(); } i++; } for (int j = 0; j < i; j++) { double denom = x[j][0] * x[j][4] - x[j][1] * x[j][3]; double numX = x[j][2] * x[j][4] - x[j][1] * x[j][5]; double numY = x[j][0] * x[j][5] - x[j][2] * x[j][3]; double ansX = numX == 0 ? Math.abs(numX / denom) : numX / denom; double ansY = numY == 0 ? Math.abs(numY / denom) : numY / denom; System.out.printf("%.4f %.4f%n", ansX, ansY); } } }
import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner stdIn = null; stdIn = new Scanner(new BufferedReader(new InputStreamReader(System.in))); double[][] x = new double[10000][6]; int i = 0; while (stdIn.hasNext()) { if (stdIn.hasNextDouble()) { for (int j = 0; j < 6; j++) { x[i][j] = stdIn.nextDouble(); } } else { stdIn.next(); } i++; } for (int j = 0; j < i; j++) { double denom = x[j][0] * x[j][4] - x[j][1] * x[j][3]; double numX = x[j][2] * x[j][4] - x[j][1] * x[j][5]; double numY = x[j][0] * x[j][5] - x[j][2] * x[j][3]; double ansX = numX == 0 ? Math.abs(numX / denom) : numX / denom; double ansY = numY == 0 ? Math.abs(numY / denom) : numY / denom; System.out.printf("%.3f %.3f%n", ansX, ansY); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
313
2
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static double x, y; static double a[] = new double[6]; public static void main(String[] args) { while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; for (int i = 0; i < 6; i++) { a[i] = sc.nextDouble(); } return true; } static void solve() { double don = (a[0] * a[4] - a[3] * a[1]); x = (a[2] * a[4] - a[1] * a[5]) / don; y = (a[0] * a[5] - a[3] * a[2]) / don; if (-0.0005 < x && x <= 0) x = 0; if (-0.0005 < y && y <= 0) y = 0; System.out.printf("%.3f %.3f", x, y); } }
import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); static double x, y; static double a[] = new double[6]; public static void main(String[] args) { while (read()) { solve(); } } static boolean read() { if (!sc.hasNext()) return false; for (int i = 0; i < 6; i++) { a[i] = sc.nextDouble(); } return true; } static void solve() { double don = (a[0] * a[4] - a[3] * a[1]); x = (a[2] * a[4] - a[1] * a[5]) / don; y = (a[0] * a[5] - a[3] * a[2]) / don; if (-0.0005 < x && x <= 0) x = 0; if (-0.0005 < y && y <= 0) y = 0; System.out.printf("%.3f %.3f\n", x, y); } }
[["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
244
1
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { double a = scanner.nextDouble(); double b = scanner.nextDouble(); double c = scanner.nextDouble(); double d = scanner.nextDouble(); double e = scanner.nextDouble(); double f = scanner.nextDouble(); double x = 0; double y = 0; x = (c * e - b * f) / (a * e - b * d); y = (c * d - a * f) / (b * d - a * e); if (x == -0) { x = 0; } if (y == -0) { y = 0; } System.out.printf("%.4f %.4f\n", x, y); } } }
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { double a = scanner.nextDouble(); double b = scanner.nextDouble(); double c = scanner.nextDouble(); double d = scanner.nextDouble(); double e = scanner.nextDouble(); double f = scanner.nextDouble(); double x = 0; double y = 0; x = (c * e - b * f) / (a * e - b * d); y = (c * d - a * f) / (b * d - a * e); if (x == -0) { x = 0; } if (y == -0) { y = 0; } System.out.printf("%.3f %.3f\n", x, y); } } }
[["-", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 491]]
3
195
2
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); double d = sc.nextDouble(); double e = sc.nextDouble(); double f = sc.nextDouble(); double det = a * e - b * d; if (det != 0) { double x = (double)((e * c - b * f) / det); double y = (double)((d * c - a * f) / det); if (x == 0) x = 0; if (y == 0) y = 0; System.out.printf("%.3f %.3f", x, y); } } } }
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); double d = sc.nextDouble(); double e = sc.nextDouble(); double f = sc.nextDouble(); double det = a * e - b * d; if (det != 0) { double x = (double)((e * c - b * f) / det); double y = (double)((-d * c + a * f) / det); if (x == 0) x = 0; if (y == 0) y = 0; System.out.printf("%.3f %.3f\n", x, y); } } } }
[["+", 31, 23, 0, 16, 31, 16, 31, 91, 17, 33], ["-", 51, 23, 0, 16, 31, 23, 0, 16, 17, 33], ["+", 51, 23, 0, 16, 31, 23, 0, 16, 17, 72], ["+", 0, 1, 0, 492, 3, 4, 0, 5, 0, 44]]
3
192
4
#include <stdio.h> /* ax + by = c dx + ey = f ax = c - by x = (c - by) / a dx = f - ey x = (f - ey) / d (c - by) / a = (f - ey) / d d(c - by) = a(f - ey) dc - bdy = af - aey aey - bdy = af - dc y(ae - bd) = af - dc y = (af - dc) / (ae - bd) */ int main() { double a, b, c, d, e, f, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); x = (f - e * y) / d; // if (x > (double)-0.001 && x <= (double)0) x = 0; // if (y > (double)-0.001 && y <= (double)0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
#include <stdio.h> /* ax + by = c dx + ey = f ax = c - by x = (c - by) / a dx = f - ey x = (f - ey) / d (c - by) / a = (f - ey) / d d(c - by) = a(f - ey) dc - bdy = af - aey aey - bdy = af - dc y(ae - bd) = af - dc y = (af - dc) / (ae - bd) */ int main() { double a, b, c, d, e, f, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); // x = (f - e * y) / d; x = (c - b * y) / a; // if (x > (double)-0.001 && x <= (double)0) x = 0; // if (y > (double)-0.001 && y <= (double)0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
0
108
6
#include <stdio.h> /* ax + by = c dx + ey = f ax = c - by x = (c - by) / a dx = f - ey x = (f - ey) / d (c - by) / a = (f - ey) / d d(c - by) = a(f - ey) dc - bdy = af - aey aey - bdy = af - dc y(ae - bd) = af - dc y = (af - dc) / (ae - bd) */ int main() { double a, b, c, d, e, f, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); x = (f - e * y) / d; if (x > (double)-0.001 && x <= (double)0) x = 0; if (y > (double)-0.001 && y <= (double)0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
#include <stdio.h> /* ax + by = c dx + ey = f ax = c - by x = (c - by) / a dx = f - ey x = (f - ey) / d (c - by) / a = (f - ey) / d d(c - by) = a(f - ey) dc - bdy = af - aey aey - bdy = af - dc y(ae - bd) = af - dc y = (af - dc) / (ae - bd) */ int main() { double a, b, c, d, e, f, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - d * c) / (a * e - b * d); // x = (f - e * y) / d; x = (c - b * y) / a; if (x > (double)-0.001 && x <= (double)0) x = 0; if (y > (double)-0.001 && y <= (double)0) y = 0; printf("%.3lf %.3lf\n", x, y); } return 0; }
[["-", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 31, 22], ["-", 12, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
146
8
#include <stdio.h> void calc_inverse_matrix(double mat[2][2], double inv_mat[2][2]) { double det = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0]; inv_mat[0][0] = mat[1][1] / det; inv_mat[0][1] = -mat[0][1] / det; inv_mat[1][0] = -mat[1][0] / det; inv_mat[1][1] = mat[0][0] / det; } int read_inputline(double mat[2][2], double vec[2]) { return scanf("%lf %lf %lf %lf %lf %lf", &mat[0][0], &mat[0][1], &vec[0], &mat[1][0], &mat[1][1], &vec[1]); } void calc_ans(double mat[2][2], double vec[2], double ans[2]) { static inv_mat[2][2]; calc_inverse_matrix(mat, inv_mat); ans[0] = inv_mat[0][0] * vec[0] + inv_mat[0][1] * vec[1]; ans[1] = inv_mat[1][0] * vec[0] + inv_mat[1][1] * vec[1]; } int main() { double mat[2][2], vec[2], inv_mat[2][2], ans[2]; while (read_inputline(mat, vec) != EOF) { calc_ans(mat, vec, ans); printf("%.3f %.3f\n", ans[0], ans[1]); } return 0; }
#include <stdio.h> void calc_inverse_matrix(double mat[2][2], double inv_mat[2][2]) { double det = mat[0][0] * mat[1][1] - mat[0][1] * mat[1][0]; inv_mat[0][0] = mat[1][1] / det; inv_mat[0][1] = -mat[0][1] / det; inv_mat[1][0] = -mat[1][0] / det; inv_mat[1][1] = mat[0][0] / det; } int read_inputline(double mat[2][2], double vec[2]) { return scanf("%lf %lf %lf %lf %lf %lf", &mat[0][0], &mat[0][1], &vec[0], &mat[1][0], &mat[1][1], &vec[1]); } void calc_ans(double mat[2][2], double vec[2], double ans[2]) { static double inv_mat[2][2]; calc_inverse_matrix(mat, inv_mat); ans[0] = inv_mat[0][0] * vec[0] + inv_mat[0][1] * vec[1]; ans[1] = inv_mat[1][0] * vec[0] + inv_mat[1][1] * vec[1]; } int main() { double mat[2][2], vec[2], inv_mat[2][2], ans[2]; while (read_inputline(mat, vec) != EOF) { calc_ans(mat, vec, ans); printf("%.3f %.3f\n", ans[0], ans[1]); } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 39, 78, 0, 22]]
0
391
2
#include <stdio.h> int main(void) { double a[3], b[3], c[3], d[3], e[3], f[3]; double x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a[0], &b[0], &c[0], &d[0], &e[0], &f[0]) != EOF) { a[1] = a[0] * e[0]; b[1] = b[0] * e[0]; c[1] = c[0] * e[0]; d[1] = d[0] * b[0]; e[1] = e[0] * b[0]; f[1] = f[0] * b[0]; x = (c[1] - f[1]) / (a[1] - d[1]); if (x == -0) x = 0; a[2] = a[0] * d[0]; b[2] = b[0] * d[0]; c[2] = c[0] * d[0]; d[2] = d[0] * a[0]; e[2] = e[0] * a[0]; f[2] = f[0] * a[0]; y = (c[2] - f[2]) / (b[2] - e[2]); if (y == -0) y = 0; printf("%f %f\n", x, y); } return 0; }
#include <stdio.h> int main(void) { double a[3], b[3], c[3], d[3], e[3], f[3]; double x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a[0], &b[0], &c[0], &d[0], &e[0], &f[0]) != EOF) { a[1] = a[0] * e[0]; b[1] = b[0] * e[0]; c[1] = c[0] * e[0]; d[1] = d[0] * b[0]; e[1] = e[0] * b[0]; f[1] = f[0] * b[0]; x = (c[1] - f[1]) / (a[1] - d[1]); if (x == -0) x = 0; a[2] = a[0] * d[0]; b[2] = b[0] * d[0]; c[2] = c[0] * d[0]; d[2] = d[0] * a[0]; e[2] = e[0] * a[0]; f[2] = f[0] * a[0]; y = (c[2] - f[2]) / (b[2] - e[2]); if (y == -0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
361
2
#include <stdio.h> int main() { float a, b, c, d, e, f, x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (d * c - a * f) / (d * b - a * e); x = (b * y - c) / a; printf("%.3f %.3f\n", x, y); } return 0; }
#include <stdio.h> int main() { float a, b, c, d, e, f, x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (d * c - a * f) / (d * b - a * e); x = (-b * y + c) / a; printf("%.3lf %.3lf\n", x, y); } return 0; }
[["+", 31, 23, 0, 16, 31, 16, 31, 91, 17, 33], ["-", 0, 11, 12, 16, 31, 23, 0, 16, 17, 33], ["+", 0, 11, 12, 16, 31, 23, 0, 16, 17, 72], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
105
5
#include <stdio.h> int main(int argc, const char *argv[]) { double a[3], b[3]; double x = 0, y = 0; double fa[2], fb[2]; while (scanf("%lf %lf %lf %lf %lf %lf", &a[0], &a[1], &a[2], &b[0], &b[1], &b[2]) != EOF) { fa[0] = a[1] * b[0]; fa[1] = a[2] * b[0]; fb[0] = b[1] * a[0]; fb[1] = b[2] * a[0]; y = (fa[1] - fb[1]) / (fb[0] - fb[0]); x = (a[2] - a[1] * y) / a[0]; printf("%0.3f %0.3f\n", x, y); } return 0; }
#include <stdio.h> int main(int argc, const char *argv[]) { double a[3], b[3]; double x = 0, y = 0; double fa[2], fb[2]; while (scanf("%lf %lf %lf %lf %lf %lf", &a[0], &a[1], &a[2], &b[0], &b[1], &b[2]) != EOF) { fa[0] = a[1] * b[0]; fa[1] = a[2] * b[0]; fb[0] = b[1] * a[0]; fb[1] = b[2] * a[0]; y = (fa[1] - fb[1]) / (fa[0] - fb[0]); x = (a[2] - a[1] * y) / a[0]; printf("%0.3f %0.3f\n", x, y); } return 0; }
[["-", 12, 16, 12, 23, 0, 16, 31, 69, 28, 22], ["+", 12, 16, 12, 23, 0, 16, 31, 69, 28, 22]]
0
219
2
#include <stdio.h> int main(void) { float a, b, c, d, e, f, x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - c * d) / (a * e - b * d); x = c - b * y; printf("%.3f %.3f\n", x, y); } return 0; }
#include <stdio.h> int main() { float a, b, c, d, e, f, x, y; while (scanf("%f %f %f %f %f %f", &a, &b, &c, &d, &e, &f) != EOF) { y = (a * f - c * d) / (a * e - b * d); x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 40], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 31, 23, 0, 25], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 17, 85], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
0
102
5
#include <stdio.h> double rounding(double x, int n) { double i, DP = 1; double X; for (i = 0; i < (n - 1); ++i) { DP *= 10; } X = x * DP; if (x > 0) X = (int)(X + 0.5); else X = (int)(X - 0.5); return (double)(X / DP); } double determinant(double a, double b, double c, double d) { return (a * d) - (b * c); } int main(void) { double a, b, c, d, e, f; double A, D1, D2; double x, y, X, Y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { A = determinant(a, b, d, e); D1 = determinant(c, b, f, e); D2 = determinant(a, c, d, f); x = (D1 / A); y = (D2 / A); X = rounding(x, 4); Y = rounding(y, 4); printf("%.3f %.3f", X, Y); } return 0; }
#include <stdio.h> double rounding(double x, int n) { double i, DP = 1; double X; for (i = 0; i < (n - 1); ++i) { DP *= 10; } X = x * DP; if (x > 0) X = (int)(X + 0.5); else X = (int)(X - 0.5); return (double)(X / DP); } double determinant(double a, double b, double c, double d) { return (a * d) - (b * c); } int main(void) { double a, b, c, d, e, f; double A, D1, D2; double x, y, X, Y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { A = determinant(a, b, d, e); D1 = determinant(c, b, f, e); D2 = determinant(a, c, d, f); x = (D1 / A); y = (D2 / A); X = rounding(x, 4); Y = rounding(y, 4); printf("%.3f %.3f\n", X, Y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
275
1
#include <stdio.h> int main() { double a, b, c, d, e, f, x, y; int x2, y2; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { x = (c * e - f * b) / (a * e - d * b); y = (c - a * x) / b; x2 = x * 10000; y2 = y * 10000; if (x2 % 10 >= 5) { x2 = x2 + 1; } if (y2 % 10 >= 5) { y2 = y2 + 1; } x = x2 / 10000; y = y2 / 10000; printf("%1.3f %1.3f\n", x, y); } return 0; }
#include <stdio.h> int main() { double a, b, c, d, e, f, x, y; int x2, y2; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { x = (c * e - f * b) / (a * e - d * b); y = (c - a * x) / b; x2 = x * 10000; y2 = y * 10000; if (x2 % 10 >= 5) { x2 = x2 + 1; } if (y2 % 10 >= 5) { y2 = y2 + 1; } x = x2 / 10000.0; y = y2 / 10000.0; printf("%1.3f %1.3f\n", x, y); } return 0; }
[["-", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13], ["+", 8, 9, 0, 1, 0, 11, 12, 16, 12, 13]]
0
166
4
#include <stdio.h> int main() { double a, b, c, d, e, f, i, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { x = (f - e / b * c) / (d - e / b * a); y = (f - d / a * c) / (e - d / a * b); if (x == 0) x = 0; if (y == 0) y = 0; printf(".3%f %.3f\n", x, y); } return 0; }
#include <stdio.h> int main() { double a, b, c, d, e, f, i, x, y; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { x = (f - e / b * c) / (d - e / b * a); y = (f - d / a * c) / (e - d / a * b); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
137
2
#include <stdio.h> int main(void) { double a, b, c, d, e, f, x, y, work1, work2; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { work1 = c * e - b * f; work2 = a * e - b * d; x = work1 / work2; work1 = c * d - a * f; work2 = b * d - a * e; y = work1 / work2; if (x <= 0 && x > -0.0001) x = 0; if (y <= 0 && y > -0.0001) y = 0; printf("%.3f %.3f", x, y); } return 0; }
#include <stdio.h> int main(void) { double a, b, c, d, e, f, x, y, work1, work2; while (scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f) != EOF) { work1 = c * e - b * f; work2 = a * e - b * d; x = work1 / work2; work1 = c * d - a * f; work2 = b * d - a * e; y = work1 / work2; if (x <= 0 && x > -0.0001) x = 0; if (y <= 0 && y > -0.0001) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
155
1
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; double solveY(int a, int b, int c, int d, int e, int f) { double ret; ret = (double)(a * f - d * c) / (a * e - b * d); return ret; } int main() { while (1) { int a, b, c, d, e, f; if (!(cin >> a >> b >> c >> d >> e >> f)) break; double y = solveY(a, b, c, d, e, f); double x = (c - b * y) / a; printf("%5.3lf %5.3lf", x, y); } return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <string> #include <vector> using namespace std; double solveY(int a, int b, int c, int d, int e, int f) { double ret; ret = (double)(a * f - d * c) / (a * e - b * d); return ret; } int main() { while (1) { int a, b, c, d, e, f; if (!(cin >> a >> b >> c >> d >> e >> f)) break; double y = solveY(a, b, c, d, e, f); double x = (c - b * y) / a; printf("%5.3lf %5.3lf\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
161
1
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define vi vector<int> #define pb push_back #define INF 999999999 const double EPS = 1e-8; typedef vector<double> vd; typedef vector<vd> mat; // Ax=b????§£??? A?????£????????? //?§£??????or????????§?????? ??´????????????0???vector????????? vd gauss_jordan(const mat &A, const vd &b) { int n = A.size(); mat B(n, vd(n + 1)); rep(i, n) rep(j, n) B[i][j] = A[i][j]; //??????A????????????b????????????????????????????????? rep(i, n) B[i][n] = b[i]; rep(i, n) { //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£????????? int pivot = i; for (int j = i; j < n; j++) { if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j; } swap(B[i], B[pivot]); //?§£??????or????????§?????? if (abs(B[i][i]) < EPS) return vd(); //??¨????????????????????°????????°???1????????? for (int j = i + 1; j <= n; j++) B[i][j] /= B[i][i]; rep(j, n) { if (i != j) { // j??????????????°????¶???? for (int k = i + 1; k <= n; k++) B[j][k] -= B[j][i] * B[i][k]; } } } vd x(n); //??????????????????b????§£????????? rep(i, n) x[i] = B[i][n]; return x; } int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { vd vec; vec.pb(c); vec.pb(f); mat mvec; vd x, y; x.pb(a); x.pb(b); y.pb(d); y.pb(e); mvec.pb(x); mvec.pb(y); vd res = gauss_jordan(mvec, vec); printf("%.10lf %.10lf\n", res[0], res[1]); } }
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define vi vector<int> #define pb push_back #define INF 999999999 const double EPS = 1e-8; typedef vector<double> vd; typedef vector<vd> mat; // Ax=b????§£??? A?????£????????? //?§£??????or????????§?????? ??´????????????0???vector????????? vd gauss_jordan(const mat &A, const vd &b) { int n = A.size(); mat B(n, vd(n + 1)); rep(i, n) rep(j, n) B[i][j] = A[i][j]; //??????A????????????b????????????????????????????????? rep(i, n) B[i][n] = b[i]; rep(i, n) { //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£????????? int pivot = i; for (int j = i; j < n; j++) { if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j; } swap(B[i], B[pivot]); //?§£??????or????????§?????? if (abs(B[i][i]) < EPS) return vd(); //??¨????????????????????°????????°???1????????? for (int j = i + 1; j <= n; j++) B[i][j] /= B[i][i]; rep(j, n) { if (i != j) { // j??????????????°????¶???? for (int k = i + 1; k <= n; k++) B[j][k] -= B[j][i] * B[i][k]; } } } vd x(n); //??????????????????b????§£????????? rep(i, n) x[i] = B[i][n]; return x; } int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { vd vec; vec.pb(c); vec.pb(f); mat mvec; vd x, y; x.pb(a); x.pb(b); y.pb(d); y.pb(e); mvec.pb(x); mvec.pb(y); vd res = gauss_jordan(mvec, vec); printf("%.3lf %.3lf\n", res[0], res[1]); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
496
2
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define vi vector<int> #define pb push_back #define INF 999999999 const double EPS = 1e-8; typedef vector<double> vd; typedef vector<vd> mat; // Ax=b????§£??? A?????£????????? //?§£??????or????????§?????? ??´????????????0???vector????????? vd gauss_jordan(const mat &A, const vd &b) { int n = A.size(); mat B(n, vd(n + 1)); rep(i, n) rep(j, n) B[i][j] = A[i][j]; //??????A????????????b????????????????????????????????? rep(i, n) B[i][n] = b[i]; rep(i, n) { //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£????????? int pivot = i; for (int j = i; j < n; j++) { if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j; } swap(B[i], B[pivot]); //?§£??????or????????§?????? if (abs(B[i][i]) < EPS) return vd(); //??¨????????????????????°????????°???1????????? for (int j = i + 1; j <= n; j++) B[i][j] /= B[i][i]; rep(j, n) { if (i != j) { // j??????????????°????¶???? for (int k = i + 1; k <= n; k++) B[j][k] -= B[j][i] * B[i][k]; } } } vd x(n); //??????????????????b????§£????????? rep(i, n) x[i] = B[i][n]; return x; } int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { vd vec; vec.pb(c); vec.pb(f); mat mvec; vd x, y; x.pb(a); x.pb(b); y.pb(d); y.pb(e); mvec.pb(x); mvec.pb(y); vd res = gauss_jordan(mvec, vec); printf("%.10lf %.10lf\n", res[0], res[1]); } }
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) #define all(a) (a).begin(), (a).end() #define vi vector<int> #define pb push_back #define INF 999999999 const double EPS = 1e-8; typedef vector<double> vd; typedef vector<vd> mat; // Ax=b????§£??? A?????£????????? //?§£??????or????????§?????? ??´????????????0???vector????????? vd gauss_jordan(const mat &A, const vd &b) { int n = A.size(); mat B(n, vd(n + 1)); rep(i, n) rep(j, n) B[i][j] = A[i][j]; rep(i, n) B[i][n] = b[i]; //??????A????????????b????????????????????????????????? rep(i, n) { int pivot = i; for ( int j = i; j < n; j++) { //??¨????????????????????°????????°?????¶???????????§????????????i??????????????£????????? if (abs(B[j][i]) > abs(B[pivot][i])) pivot = j; } swap(B[i], B[pivot]); if (abs(B[i][i]) < EPS) return vd(); //?§£??????or????????§?????? for (int j = i + 1; j <= n; j++) B[i][j] /= B[i][i]; //??¨????????????????????°????????°???1????????? rep(j, n) { if (i != j) { for (int k = i + 1; k <= n; k++) B[j][k] -= B[j][i] * B[i][k]; // j??????????????°????¶???? } } } vd x(n); rep(i, n) x[i] = B[i][n]; //??????????????????b????§£????????? return x; } int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { vd vec; vec.pb(c); vec.pb(f); mat mvec; vd x, y; x.pb(a); x.pb(b); y.pb(d); y.pb(e); mvec.pb(x); mvec.pb(y); vd res = gauss_jordan(mvec, vec); printf("%.3lf %.3lf\n", res[0], res[1]); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
496
2
#include <iostream> #include <stdio.h> using namespace std; int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double anx = 0, any = 0; if ((c * e - f * b) != 0 && (a * e - d * b) != 0) { anx = (c * e - f * b) / (a * e - d * b); } if ((c * d - f * a) != 0 && (b * d - e * a) != 0) { any = (c * d - f * a) / (b * d - e * a); } printf("%.3f ", anx); printf("%.3f\n", any); } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double anx = 0, any = 0; if ((c * e - f * b) != 0 && (a * e - d * b) != 0) { anx = (c * e - f * b) / (a * e - d * b); } if ((c * d - f * a) != 0 && (b * d - e * a) != 0) { any = (c * d - f * a) / (b * d - e * a); } printf("%.3f ", anx); printf("%.3f\n", any); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
176
2
#include <cstdio> #include <iostream> #define eps 1e-10 using namespace std; int main(void) { double a, b, c, d, e, f; while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { double ya = d * c - a * f; double yb = b * d - a * e; if (yb == 0) yb += eps; double y = ((ya) / (yb)); if (a == 0) a += eps; double x = ((c - b * y) / a); printf("%.3f %.3f", x, y); } return (0); }
#include <cstdio> #include <iostream> #include <limits> #define eps 1e-10 using namespace std; int main(void) { double a, b, c, d, e, f; // double inf = numeric_limits<double>::infinity(); while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF) { double ya = d * c - a * f; double yb = b * d - a * e; if (yb == 0) yb += eps; double y = ((ya) / (yb)); // if(yb == 0) y = inf; if (a == 0) a += eps; double x = ((c - b * y) / a); // if(a == 0) x = inf; printf("%.3f %.3f\n", x, y); } return (0); }
[["+", 36, 36, 36, 36, 0, 30, 0, 135, 0, 138], ["+", 36, 36, 36, 36, 0, 30, 0, 135, 136, 137], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
148
3
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define all(a) (a).begin(), (a).end() #define EPS 1e-9 int main(void) { int a, b, c, d, e, f; float x, y, dx, dy; while (cin >> a >> b >> c >> d >> e >> f) { x = (c * e - b * f) / (float)(a * e - b * d); y = (c - a * c) / (float)b; printf("%.3f %.3f\n", x + EPS, y + EPS); } }
#include <algorithm> #include <cmath> #include <complex> #include <cstdio> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define loop(i, a, b) for (int i = a; i < b; i++) #define rep(i, a) loop(i, 0, a) #define all(a) (a).begin(), (a).end() #define EPS 1e-9 int main(void) { int a, b, c, d, e, f; float x, y, dx, dy; while (cin >> a >> b >> c >> d >> e >> f) { x = (c * e - b * f) / (float)(a * e - b * d); y = (c - a * x) / (float)b; printf("%.3f %.3f\n", x + EPS, y + EPS); } }
[["-", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22], ["+", 12, 16, 31, 23, 0, 16, 12, 16, 12, 22]]
1
187
2
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { x = (double)(e * c - b * f) / (a * e - b * d); y = (double)(a * f - d * c) / (a * e - b * d); if (x == 0) y = 0; if (y == 0) x = 0; printf("%.3f %.3f\n", x, y); } }
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { x = (double)(e * c - b * f) / (a * e - b * d); y = (double)(a * f - d * c) / (a * e - b * d); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 35]]
1
133
7
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double x, y; y = (c * d - a * f) / (b * d - a * e); x = (c - b * y) / a; // cout<<x<<' '<<y<<endl; printf("%.4lf %.4lf", x, y); cout << endl; } }
#include <cmath> #include <cstdio> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double x, y; y = (c * d - a * f) / (b * d - a * e); x = (c - b * y) / a; // cout<<x<<' '<<y<<endl; printf("%.3lf %.3lf", x, y); cout << endl; } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
102
2
#include <cstdio> #include <iostream> using namespace std; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); double a, b, c, d, e, f; while (cin >> a, cin >> b, cin >> c, cin >> d, cin >> e, cin >> f) { printf("%.4f %.4f\n", (c * e - f * b) / (a * e - d * b) + 0, (c * d - f * a) / (b * d - e * a) + 0); } return 0; }
#include <cstdio> #include <iostream> using namespace std; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); double a, b, c, d, e, f; while (cin >> a, cin >> b, cin >> c, cin >> d, cin >> e, cin >> f) { printf("%.3f %.3f\n", (c * e - f * b) / (a * e - d * b) + 0, (c * d - f * a) / (b * d - e * a) + 0); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
128
2
#include <iostream> using namespace std; int main() { double a[6]; double x, y; while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5]) { double b = a[0] * a[4] - a[1] * a[3]; double c = a[0]; a[0] = a[4]; a[4] = c; a[1] *= -1.0; a[3] *= -1.0; x = (a[0] * a[2] + a[1] * a[5]) / b; y = (a[3] * a[2] + a[4] * a[5]) / b; if (x = -0.0) x = 0.0; if (y = -0.0) y = 0.0; printf("%.3f %.3f\n", x, y); } return 0; }
#include <iostream> using namespace std; int main() { double a[6]; double x, y; while (cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5]) { double b = a[0] * a[4] - a[1] * a[3]; double c = a[0]; a[0] = a[4]; a[4] = c; a[1] *= -1.0; a[3] *= -1.0; x = (a[0] * a[2] + a[1] * a[5]) / b; y = (a[3] * a[2] + a[4] * a[5]) / b; if (x == -0.0) x = 0.0; if (y == -0.0) y = 0.0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
208
4
#include <cstdio> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { y = (a * f - d * c) / (a * e - b * d); x = (c - b * y) / a; printf("%9f %9f\n", x, y); } }
#include <cstdio> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { y = (a * f - d * c) / (a * e - b * d); x = (c - b * y) / a; printf("%.3f %.3f\n", x, y); } }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
96
2
#include <cstdio> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { double a, b, c, d, e, f, aa, bb, cc, i = 0, x, y; cin >> a >> b >> c >> d >> e >> f; aa = a; bb = b; cc = c; a = a * d; b = b * d; c = c * d; d = d * aa; e = e * aa; f = f * aa; y = (c - f) / (b - e); x = cc - (bb * y); x = x / aa; cout << fixed << setprecision(3) << x << " " << fixed << setprecision(3) << y << endl; }
#include <cstdio> #include <iomanip> #include <iostream> #include <string> using namespace std; int main() { double a, b, c, d, e, f, aa, bb, cc, i = 0, x, y; while (cin >> a >> b >> c >> d >> e >> f) { aa = a; bb = b; cc = c; a = a * d; b = b * d; c = c * d; d = d * aa; e = e * aa; f = f * aa; y = (c - f) / (b - e); x = cc - (bb * y); x = x / aa; cout << fixed << setprecision(3) << x << " " << fixed << setprecision(3) << y << endl; } }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
163
6
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double x, y; x = (c - b * (a * f - c * d) / (a * e - b * d)) / a; y = (a * f - c * d) / (a * e - b * d); printf("%.3f %.3f\n", x, y); } }
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <vector> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double x, y; x = (c - b * (a * f - c * d) / (a * e - b * d)) / a; y = (a * f - c * d) / (a * e - b * d); printf("%.3f %.3f\n", x, y); } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
120
2
#include <algorithm> #include <functional> #include <iomanip> #include <ios> #include <iostream> #include <math.h> #include <string> #define YES "YES" #define NO "NO" #define space ' ' using namespace std; void func(); int main(void) { func(); return 0; } // using matrix ?????????????????´?????? void func() { int a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()) { cout << fixed << setprecision(3); if ((a * e - d * b) == 0) x = 0.0, y = 0.0; else { x = (e * c - b * f) / (a * e - d * b); y = (-(d * c) + a * f) / (a * e - d * b); if (x == 0) x = 0.0; if (y == 0) y = 0.0; } cout << x << space << y << endl; cout << dec; } }
#include <algorithm> #include <functional> #include <iomanip> #include <ios> #include <iostream> #include <math.h> #include <string> #define YES "YES" #define NO "NO" #define space ' ' using namespace std; void func(); int main(void) { func(); return 0; } // using matrix ?????????????????´?????? void func() { double a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()) { cout << fixed << setprecision(3); if ((a * e - d * b) == 0) x = 0.0, y = 0.0; else { x = ((e * c - b * f) / (a * e - d * b)); y = ((-(d * c) + a * f) / (a * e - d * b)); if (x == 0) x = 0.0; if (y == 0) y = 0.0; } cout << x << space << y << endl; cout << dec; } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 9, 0, 1, 0, 11, 12, 23, 0, 24], ["+", 0, 11, 12, 23, 0, 16, 12, 23, 0, 25]]
1
211
6
#include <bits/stdc++.h> using namespace std; template <typename T> class Vector { protected: vector<T> val; public: Vector(int n) : val(n, 0) {} T &operator[](int n) { return val[n]; } Vector operator+=(const Vector &v) { for (int i = 0; i < size(); ++i) val[i] += v[i]; return *this; } Vector operator-=(const Vector &v) { for (int i = 0; i < size(); ++i) val[i] -= v[i]; return *this; } Vector operator+(const Vector &v) const { Vector res = *this; res += v; return res; } Vector operator-(const Vector &v) const { Vector res = *this; res -= v; return res; } T operator*(const Vector &v) const { T res = 0; for (int i = 0; i < size(); ++i) res += val[i] + v[i]; return res; } int size() const { return val.size(); } }; template <typename T> class Matrix { protected: vector<vector<T>> val; public: Matrix(int n, int m) : val(n, vector<T>(m, 0)) {} vector<T> &operator[](int n) { return val[n]; } Matrix operator+=(const Matrix &m) { for (int i = 0; i < (int)val.size(); ++i) val[i] += m[i]; return *this; } Matrix operator-=(const Matrix &m) { for (int i = 0; i < (int)val.size(); ++i) val[i] -= m[i]; return *this; } Matrix operator*=(Matrix m) { return *this = *this * m; } Matrix operator+(const Matrix &m) const { Matrix res = *this; res += m; return res; } Matrix operator-(const Matrix &m) const { Matrix res = *this; res -= m; return res; } Matrix operator*(Matrix m) { Matrix res(size(), m[0].size()); for (int i = 0; i < size(); ++i) { for (int j = 0; j < m.size(); ++j) { for (int k = 0; k < m[0].size(); ++k) { res[i][k] += val[i][j] * m[j][k]; } } } return res; } Vector<T> operator*(Vector<T> &v) { Vector<T> res(size()); for (int i = 0; i < size(); ++i) { for (int j = 0; j < v.size(); ++j) res[i] += val[i][j] * v[j]; } return res; } int size() const { return val.size(); } }; template <typename T> class SquareMatrix : public Matrix<T> { public: SquareMatrix(int n) : Matrix<T>(n, n) {} SquareMatrix(const Matrix<T> &m) : Matrix<T>(m) {} SquareMatrix operator/=(SquareMatrix &m) { return *this *= m.inverse(); } SquareMatrix operator/(SquareMatrix m) { return *this * m.inverse(); } SquareMatrix identity() const { SquareMatrix res(this->size()); for (int i = 0; i < this->size(); ++i) res[i][i] = 1; return res; } SquareMatrix inverse() const { int n = this->size(); SquareMatrix mat = *this; SquareMatrix inv = identity(); for (int i = 0; i < n; ++i) { int p = i; for (int j = i + 1; j < n; ++j) { if (abs(mat[j][i]) > abs(mat[p][i])) p = j; } swap(mat[i], mat[p]); swap(inv[i], inv[p]); for (int j = i + 1; j < n; ++j) mat[i][j] /= mat[i][i]; for (int j = 0; j < n; ++j) inv[i][j] /= mat[i][i]; mat[i][i] = 1; for (int j = 0; j < n; ++j) { if (i == j) continue; T a = mat[j][i]; for (int k = 0; k < n; ++k) { inv[j][k] -= a * inv[i][k]; mat[j][k] -= a * mat[i][k]; } } } return inv; } }; int main() { SquareMatrix<double> m(2); Vector<double> v(2); while (cin >> m[0][0] >> m[0][1] >> v[0] >> m[1][0] >> m[1][1] >> v[1]) { auto res = m.inverse() * v; cout << fixed << setprecision(15) << res[0] << " " << fixed << setprecision(15) << res[1] << endl; } }
#include <bits/stdc++.h> using namespace std; template <typename T> class Vector { protected: vector<T> val; public: Vector(int n) : val(n, 0) {} T &operator[](int n) { return val[n]; } Vector operator+=(const Vector &v) { for (int i = 0; i < size(); ++i) val[i] += v[i]; return *this; } Vector operator-=(const Vector &v) { for (int i = 0; i < size(); ++i) val[i] -= v[i]; return *this; } Vector operator+(const Vector &v) const { Vector res = *this; res += v; return res; } Vector operator-(const Vector &v) const { Vector res = *this; res -= v; return res; } T operator*(const Vector &v) const { T res = 0; for (int i = 0; i < size(); ++i) res += val[i] + v[i]; return res; } int size() const { return val.size(); } }; template <typename T> class Matrix { protected: vector<vector<T>> val; public: Matrix(int n, int m) : val(n, vector<T>(m, 0)) {} vector<T> &operator[](int n) { return val[n]; } Matrix operator+=(const Matrix &m) { for (int i = 0; i < (int)val.size(); ++i) val[i] += m[i]; return *this; } Matrix operator-=(const Matrix &m) { for (int i = 0; i < (int)val.size(); ++i) val[i] -= m[i]; return *this; } Matrix operator*=(Matrix m) { return *this = *this * m; } Matrix operator+(const Matrix &m) const { Matrix res = *this; res += m; return res; } Matrix operator-(const Matrix &m) const { Matrix res = *this; res -= m; return res; } Matrix operator*(Matrix m) { Matrix res(size(), m[0].size()); for (int i = 0; i < size(); ++i) { for (int j = 0; j < m.size(); ++j) { for (int k = 0; k < m[0].size(); ++k) { res[i][k] += val[i][j] * m[j][k]; } } } return res; } Vector<T> operator*(Vector<T> &v) { Vector<T> res(size()); for (int i = 0; i < size(); ++i) { for (int j = 0; j < v.size(); ++j) res[i] += val[i][j] * v[j]; } return res; } int size() const { return val.size(); } }; template <typename T> class SquareMatrix : public Matrix<T> { public: SquareMatrix(int n) : Matrix<T>(n, n) {} SquareMatrix(const Matrix<T> &m) : Matrix<T>(m) {} SquareMatrix operator/=(SquareMatrix &m) { return *this *= m.inverse(); } SquareMatrix operator/(SquareMatrix m) { return *this * m.inverse(); } SquareMatrix identity() const { SquareMatrix res(this->size()); for (int i = 0; i < this->size(); ++i) res[i][i] = 1; return res; } SquareMatrix inverse() const { int n = this->size(); SquareMatrix mat = *this; SquareMatrix inv = identity(); for (int i = 0; i < n; ++i) { int p = i; for (int j = i + 1; j < n; ++j) { if (abs(mat[j][i]) > abs(mat[p][i])) p = j; } swap(mat[i], mat[p]); swap(inv[i], inv[p]); for (int j = i + 1; j < n; ++j) mat[i][j] /= mat[i][i]; for (int j = 0; j < n; ++j) inv[i][j] /= mat[i][i]; mat[i][i] = 1; for (int j = 0; j < n; ++j) { if (i == j) continue; T a = mat[j][i]; for (int k = 0; k < n; ++k) { inv[j][k] -= a * inv[i][k]; mat[j][k] -= a * mat[i][k]; } } } return inv; } }; int main() { SquareMatrix<double> m(2); Vector<double> v(2); while (cin >> m[0][0] >> m[0][1] >> v[0] >> m[1][0] >> m[1][1] >> v[1]) { auto res = m.inverse() * v; cout << fixed << setprecision(3) << res[0] << " " << fixed << setprecision(3) << res[1] << endl; } }
[["-", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13], ["+", 31, 16, 31, 16, 12, 2, 3, 4, 0, 13]]
1
1,230
4
#include <cstdio> #include <iostream> /* * Wrong Answer * 2015-06-26 02:00 */ int main(void) { int a, b, c, d, e, f; double x, y; while (std::cin >> a >> b >> c >> d >> e >> f) { y = (a * f - c * d) / (a * e - b * d); x = (c - b * ((a * f - c * d) / (a * e - b * d))) / a; printf("%.3f %.3f\n", x, y); } return 0; }
#include <cstdio> #include <iostream> /* * Wrong Answer * 2015-06-26 02:00 */ int main(void) { double a, b, c, d, e, f, x, y; while (std::cin >> a >> b >> c >> d >> e >> f) { y = (a * f - c * d) / (a * e - b * d); x = (c - b * ((a * f - c * d) / (a * e - b * d))) / a; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21]]
1
119
5
#include <cstdio> #include <iostream> int main() { double a, b, c, d, e, f, y, x; while (std::cin >> a >> b >> c >> d >> e >> f) { x = (double)((e * c - b * f) / (a * e - b * d)); y = (double)((-(d * c) + a * f) / (a * e - b * d)); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3lf %.3lf", x, y); } return 0; }
#include <cstdio> #include <iostream> int main() { double a, b, c, d, e, f, y, x; while (std::cin >> a >> b >> c >> d >> e >> f) { x = (double)((e * c - b * f) / (a * e - b * d)); y = (double)((-(d * c) + a * f) / (a * e - b * d)); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3lf %.3lf\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
138
1
#include <cstdio> #include <iostream> using namespace std; // a = 1のとき // x = c - by // d(c-by)*ey=f // y = (f - dc) / (e - db) double func1(double y1, double r1, double x2, double y2, double r2) { double temp1 = x2 * y1; double temp2 = x2 * r1; return (r2 - temp2) / (y2 - temp1); } int main() { double a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; double x = 0.0, y = 0.0; // double型は等価比較してはいけないといわれるが、 // 一度も計算していないためこのケースは問題なし if (a == 1.0) { y = func1(b, c, d, e, f); x = c - b * y; } else if (d == 1.0) { y = func1(e, f, a, b, c); x = f - e * y; } else if (b == 1.0) { x = func1(a, c, e, d, f); y = c - a * x; } else if (e == 1.0) { x = func1(d, f, b, a, c); y = f - d * x; } else { // aが1となるように計算 double a_1 = 1.0, b_1 = b / a, c_1 = c / a; y = func1(b_1, c_1, d, e, f); x = c_1 - b_1 * y; } printf("%.3f %.3f\n", x, y); return 0; }
#include <cstdio> #include <iostream> using namespace std; // a = 1のとき // x = c - by // d(c-by)*ey=f // y = (f - dc) / (e - db) double func1(double y1, double r1, double x2, double y2, double r2) { double temp1 = x2 * y1; double temp2 = x2 * r1; return (r2 - temp2) / (y2 - temp1); } int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double x = 0.0, y = 0.0; // double型は等価比較してはいけないといわれるが、 // 一度も計算していないためこのケースは問題なし if (a == 1.0) { y = func1(b, c, d, e, f); x = c - b * y; } else if (d == 1.0) { y = func1(e, f, a, b, c); x = f - e * y; } else if (b == 1.0) { x = func1(a, c, e, d, f); y = c - a * x; } else if (e == 1.0) { x = func1(d, f, b, a, c); y = f - d * x; } else { // aが1となるように計算 double a_1 = 1.0, b_1 = b / a, c_1 = c / a; y = func1(b_1, c_1, d, e, f); x = c_1 - b_1 * y; } printf("%.3f %.3f\n", x, y); } return 0; }
[["+", 0, 30, 0, 14, 8, 9, 0, 52, 0, 89], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 24], ["-", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 52, 15, 339, 0, 25], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
289
6
#include <iostream> #include <stdio.h> using namespace std; int main(void) { int a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { y = (c * d - a * f) / (b * d - a * e); x = (c - b * y) / a; printf("%.3lf ", x); printf("%.3lf\n", y); } return 0; }
#include <iostream> #include <stdio.h> using namespace std; int main(void) { double a, b, c, d, e, f; double x, y; while (cin >> a >> b >> c >> d >> e >> f) { y = (c * d - a * f) / (b * d - a * e); x = (c - b * y) / a; printf("%.3lf ", x); printf("%.3lf\n", y); } return 0; }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
107
2
#include <cstdio> int main() { int a, b, c, d, e, f; double x, y; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { x = (double)(e * c - b * f) / (e * a - b * d); y = (double)(c - a * x) / b; if (0.00049 > x && x > -0.00049) x = 0; if (0.00049 > x && x > -0.00049) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
#include <cstdio> int main() { int a, b, c, d, e, f; double x, y; while (scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF) { x = (double)(e * c - b * f) / (e * a - b * d); y = (double)(c - a * x) / b; if (0.00049 > x && x > -0.00049) x = 0; if (0.00049 > y && y > -0.00049) y = 0; printf("%.3f %.3f\n", x, y); } return 0; }
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 31, 16, 12, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
140
4
#include <iomanip> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e) { /* a = 2; b = -1; c = -3; d = 1; e = -1; f = -3; */ double x, y; x = (c * e - b * f) / (a * e - b * d); y = (c * d - a * f) / (b * d - a * e); if (x == -0.000) x = 0.000; if (y == -0.000) y = 0.000; cout << fixed << setprecision(3) << x << " " << y << endl; } return 0; }
#include <iomanip> #include <iostream> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { /* a = 2; b = -1; c = -3; d = 1; e = -1; f = -3; */ double x, y; x = (c * e - b * f) / (a * e - b * d); y = (c * d - a * f) / (b * d - a * e); if (x == -0.000) x = 0.000; if (y == -0.000) y = 0.000; cout << fixed << setprecision(3) << x << " " << y << endl; } return 0; }
[["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 12, 22]]
1
135
2
//#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <cstdio> //#include <cstdlib> #include <algorithm> #include <cmath> #include <iostream> //#include <cstring> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main(void) { int a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double y = (double)((a * f - d * c) / (a * e - b * d)); double x = (double)((e * c - b * f) / (a * e - b * d)); if (x == 0) x = 0.000; if (y == 0) y = 0.000; printf("%.3f %.3f\n", x, y); } return 0; } /* for(i=0;i<N;i++){ cin >> X[i]; } for(i=0;i<N;i++){ for(j=0;j<N;j++){ cin >> X[i][j]; } } */
//#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include <cstdio> //#include <cstdlib> #include <algorithm> #include <cmath> #include <iostream> //#include <cstring> #include <list> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main(void) { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { double y = (double)((a * f - d * c) / (a * e - b * d)); double x = (double)((e * c - b * f) / (a * e - b * d)); if (x == 0) x = 0.000; if (y == 0) y = 0.000; printf("%.3f %.3f\n", x, y); } return 0; } /* for(i=0;i<N;i++){ cin >> X[i]; } for(i=0;i<N;i++){ for(j=0;j<N;j++){ cin >> X[i][j]; } } */
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
159
2
#include <cstdio> #include <iostream> // x = (e * c - b * f) / (a * e - b * d) // y = (a * f - d * c) / (a * e - b * d) using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { int det = a * e - b * d; double x = (e * c - b * f) / det + 0.0; double y = (a * f - d * c) / det + 0.0; printf("%.3f %.3f", x, y); } return 0; }
#include <cstdio> #include <iostream> // x = (e * c - b * f) / (a * e - b * d) // y = (a * f - d * c) / (a * e - b * d) using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { int det = a * e - b * d; double x = (e * c - b * f) / det + 0.0; double y = (a * f - d * c) / det + 0.0; printf("%.3f %.3f\n", x, y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
106
1
#include <bits/stdc++.h> using namespace std; int main() { double a[2][3]; bool f = 0; while (cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[1][0] >> a[1][1] >> a[1][2]) { if (a[0][0] == 0) for (int i = 0; i < 3; i++) swap(a[0][i], a[1][i]), f = 1; for (int i = 0; i < 2; i++) { for (int j = i + 1; j < 3; j++) a[i][j] /= a[i][i]; a[i][i] = 1; for (int j = 0; j < 2; j++) { if (j == i) continue; double t = a[j][i]; for (int k = i; k < 3; k++) a[j][k] -= t * a[i][k]; } } printf("%f %f\n", a[0][2], a[1][2]); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { double a[2][3]; bool f = 0; while (cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[1][0] >> a[1][1] >> a[1][2]) { if (a[0][0] == 0) for (int i = 0; i < 3; i++) swap(a[0][i], a[1][i]), f = 1; for (int i = 0; i < 2; i++) { for (int j = i + 1; j < 3; j++) a[i][j] /= a[i][i]; a[i][i] = 1; for (int j = 0; j < 2; j++) { if (j == i) continue; double t = a[j][i]; for (int k = i; k < 3; k++) a[j][k] -= t * a[i][k]; } } printf("%.3f %.3f\n", a[0][2], a[1][2]); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
281
11
#include <cstdio> #include <iostream> #include <math.h> using namespace std; double a, b, c, d, e, f; double tmp_x, tmp_y, tmp; int main() { while (cin >> a >> b >> c >> d >> e >> f) { tmp_y = (d * c - a * f) / (d * b - a * e); tmp_x = (c - b * tmp_y) / a; printf("%.3f %.3f", tmp_x, tmp_y); } return 0; }
#include <cstdio> #include <iostream> #include <math.h> using namespace std; double a, b, c, d, e, f; double tmp_x, tmp_y, tmp; int main() { while (cin >> a >> b >> c >> d >> e >> f) { tmp_y = (d * c - a * f) / (d * b - a * e); tmp_x = (c - b * tmp_y) / a; printf("%.3f %.3f\n", tmp_x, tmp_y); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
102
1
#include <cstdio> #include <iostream> using namespace std; int main(void) { double x, y; int a, b, p; int c, d, q; while (cin >> a >> b >> p >> c >> d >> q) { x = (double)((p * d - b * q) / (a * d - b * c)); y = (double)((a * q - p * c) / (a * d - b * c)); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3f %.3f\n", x, y); } }
#include <cstdio> #include <iostream> using namespace std; int main(void) { double x, y; double a, b, p; double c, d, q; while (cin >> a >> b >> p >> c >> d >> q) { x = (double)((p * d - b * q) / (a * d - b * c)); y = (double)((a * q - p * c) / (a * d - b * c)); if (x == 0) x = 0; if (y == 0) y = 0; printf("%.3f %.3f\n", x, y); } }
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
138
4
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { printf("%.3f\n", (e * c - b * f) / (a * e - b * d) + 0.0); printf("%.3f\n", (a * f - d * c) / (a * e - b * d) + 0.0); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { double a, b, c, d, e, f; while (cin >> a >> b >> c >> d >> e >> f) { printf("%.3f ", (e * c - b * f) / (a * e - b * d) + 0.0); printf("%.3f\n", (a * f - d * c) / (a * e - b * d) + 0.0); } return 0; }
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
106
3
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <stack> using namespace std; int main() { int i; double no[6] = {0}, a, b; while (cin >> no[0]) { for (i = 1; i < 6; i++) { cin >> no[i]; } a = ((no[2] * no[4]) - (no[1] * no[5])) / ((no[0] * no[4]) - (no[1] * no[3])); b = ((no[3] * no[2]) - (no[0] * no[5])) / ((no[1] * no[3]) - (no[0] * no[4])); if (a == 0) a = 0; if (b == 0) b = 0; printf("%.3f %.3f", a, b); } return 0; }
#include <algorithm> #include <cmath> #include <cstdio> #include <iostream> #include <stack> using namespace std; int main() { int i; double no[6] = {0}, a, b; while (cin >> no[0]) { for (i = 1; i < 6; i++) { cin >> no[i]; } a = ((no[2] * no[4]) - (no[1] * no[5])) / ((no[0] * no[4]) - (no[1] * no[3])); b = ((no[3] * no[2]) - (no[0] * no[5])) / ((no[1] * no[3]) - (no[0] * no[4])); if (a == 0) a = 0; if (b == 0) b = 0; printf("%.3f %.3f\n", a, b); } return 0; }
[["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
212
1
n=eval(input()) for i in range(0,n): num=sorted(map(int, input().split())) a=num[0] b=num[1] c=num[2] print(num) if c*c==a*a+b*b: print("YES") else: print("NO")
n=eval(input()) for i in range(0,n): num=sorted(map(int, input().split())) a=num[0] b=num[1] c=num[2] if c*c==a*a+b*b: print("YES") else: print("NO")
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
84
4
for i in range(int(input())): a = sorted(map(int,input().split()),reversed = True) if a[0]**2 == a[1]**2 + a[2]**2: print("YES") else: print("NO")
for i in range(int(input())): a = sorted(map(int,input().split()),reverse = True) if a[0]**2 == a[1]**2 + a[2]**2: print("YES") else: print("NO")
[["-", 0, 662, 12, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 653, 141, 22]]
5
70
2
n=int(input()) a=[] c=[] for i in range(n): a.append([]) for j in range(3): a[i].append([]) print (a) for i in range(n): #for j in range(3): a[i][0], a[i][1], a[i][2]=map(int, input().split()) a[i].sort() if(((a[i][0]*a[i][0])+(a[i][1]*a[i][1]))==(a[i][2]*a[i][2])): k="YES" c.append(k) else: k="NO" c.append(k) for i in range(n): print(c[i])
n=int(input()) a=[] c=[] for i in range(n): a.append([]) for j in range(3): a[i].append([]) for i in range(n): #for j in range(3): a[i][0], a[i][1], a[i][2]=map(int, input().split()) a[i].sort() if(((a[i][0]*a[i][0])+(a[i][1]*a[i][1]))==(a[i][2]*a[i][2])): k="YES" c.append(k) else: k="NO" c.append(k) for i in range(n): print(c[i])
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
204
4
n=int(input()) for i in range(n): A=[int(j) for j in input().split()] if A[0]**2+A[1]**2==A[2]**2: print("YES") else: print("NO")
n=int(input()) for i in range(n): A=[int(j) for j in input().split()] A.sort() if A[0]**2+A[1]**2==A[2]**2: print("YES") else: print("NO")
[["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
70
5
import sys n = input() for a,b,c in map(lambda x: map(int,x.split()),sys.stdin.readlines()): print("YES" if a*a+b*b==c*c else "NO")
import sys n = input() for a,b,c in map(lambda x: sorted(map(int,x.split())),sys.stdin.readlines()): print("YES" if a*a+b*b==c*c else "NO")
[["+", 12, 652, 3, 4, 0, 670, 8, 652, 63, 22], ["+", 3, 4, 0, 670, 8, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
61
3
n = int(input()) for i in range(n): a = sorted(map(int,input().split())) if a[0]**2 + a[1]**2 == a[2]: print('YES') else: print('NO')
n = int(input()) for i in range(n): a = sorted(map(int,input().split())) if a[0]**2 + a[1]**2 == a[2]**2: print('YES') else: print('NO')
[["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
67
2
n=eval(input()) for i in range(n): inl=sorted(map(int, input().split())) if inl[0]**2+inl[1]**2==inl[2]**2: print("Yes") else: print("No")
n=eval(input()) for i in range(n): inl=sorted(map(int, input().split())) if inl[0]**2+inl[1]**2==inl[2]**2: print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
69
4
n=int(input()) r=[0]*n for i in range(n): r[i]=sorted(list(map(int,input().split()))) for i in range(n): print("Yes" if r[i][0]**2+r[i][1]**2==r[i][2]**2 else "No")
n=int(input()) r=[0]*n for i in range(n): r[i]=sorted(list(map(int,input().split()))) for i in range(n): print("YES" if r[i][0]**2+r[i][1]**2==r[i][2]**2 else "NO")
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
94
4
n = int(input()) L = [input() for i in range(n)] #L????????????????´???¨??????????????? for line in L: A = line.split() #A???line??????3????????°???????????????(?????????) B = sorted([int(A[i]) for i in range(3)]) #B???A?????°????????????????????????????????? if B[2]^2 == B[0]^2 + B[1]^2: print('YES') else: print('NO')
n = int(input()) L = [input() for i in range(n)] for line in L: A = line.split() B = sorted([int(A[i]) for i in range(3)]) if B[2]**2 == B[0]**2 + B[1]**2: print('YES') else: print('NO')
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 140], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 17, 578], ["-", 0, 57, 15, 666, 0, 657, 31, 657, 17, 140], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 17, 578], ["+", 0, 57, 15, 666, 0, 657, 12, 657, 17, 578]]
5
94
6
def isRTri(a, b, c): return a * a + b * b == c * c a = [0, 0, 0] n = eval(input()) for k in range(n): a = list(map(int, input().split())) r = isRTri(a[0], a[1], a[2]) print("YES" if r else "NO")
def isRTri(a, b, c): return a * a + b * b == c * c a = [0, 0, 0] n = eval(input()) for k in range(n): a = sorted(map(int, input().split())) r = isRTri(a[0], a[1], a[2]) print("YES" if r else "NO")
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
95
2
n = int(input()) for i in range(n): h = list(map(int,input())) h.sort() if h[0]**2 ++ h[1]**2 == h[2]**2: print('YES') else: print('NO')
n = int(input()) for i in range(n): h = list(map(int,input().split())) h.sort() if h[0]**2 ++ h[1]**2 == h[2]**2: print('YES') else: print('NO')
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
71
4
import sys n = int(sys.stdin.readline().strip()) print(n) for i in range(n): line = sys.stdin.readline() lengths = sorted(list(map(int, line.strip().split()))) if lengths[0]**2 + lengths[1]**2 == lengths[2]**2: print('YES') else: print('NO')
import sys n = int(sys.stdin.readline().strip()) for i in range(n): line = sys.stdin.readline() lengths = sorted(list(map(int, line.strip().split()))) if lengths[0]**2 + lengths[1]**2 == lengths[2]**2: print('YES') else: print('NO')
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
97
4
deta_set_count = int(input()) for _ in range(deta_set_count): k = list(map(int, input().split())) k= k.sorted() if k[0]**2 + k[1]**2 == k[2]**2: print('YES') else: print('NO')
deta_set_count = int(input()) for _ in range(deta_set_count): k = list(map(int, input().split())) k= sorted(k) if k[0]**2 + k[1]**2 == k[2]**2: print('YES') else: print('NO')
[["-", 0, 1, 0, 662, 12, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
76
3
N = int(input()) for i in range(N): a = list(map(int, input().split())) a = sorted(a) x = a[0] y = a[1] z = a[2] if x**2 + y**2 == z**2: print("yes") else: print("no")
N = int(input()) for i in range(N): a = list(map(int, input().split())) a = sorted(a) x = a[0] y = a[1] z = a[2] if x**2 + y**2 == z**2: print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
84
4
N = int(input()) for i in range(N): sides = map(int, input().split()) longestSide = max(sides) sides.remove(longestSide) if (longestSide ** 2) == (sides[0] ** 2 + sides[1] ** 2): print('YES') else: print('NO')
N = int(input()) for i in range(N): sides = list(map(int, input().split())) longestSide = max(sides) sides.remove(longestSide) if (longestSide ** 2) == (sides[0] ** 2 + sides[1] ** 2): print('YES') else: print('NO')
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
79
3
n = int(input()) for i in range(n): a, b, c = sorted(list(map(int, input().split()))) if c ** 2 == (a ** 2 + b ** 2): print("Yes") else: print("No")
n = int(input()) for i in range(n): a, b, c = sorted(list(map(int, input().split()))) if c ** 2 == (a ** 2 + b ** 2): print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
69
4
N = int(input()) for i in range(N): a, b, c = map(int, input().split()) sort = sorted([a, b, c]) if sort[0]**2 + sort[1]**2 == sort[2]**2: print("Yes") else: print("No")
N = int(input()) for i in range(N): a, b, c = map(int, input().split()) sort = sorted([a, b, c]) if sort[0]**2 + sort[1]**2 == sort[2]**2: print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
82
4
for i in range(0, int(input())): sidelen = [int(j) for j in input().split(" ")] sidelen.sort(reverse=True) if(sidelen[0]**2 == sidelen[1]**2+sidelen[2]**2): print("Yes") else: print("NO")
for i in range(0, int(input())): sidelen = [int(j) for j in input().split(" ")] sidelen.sort(reverse=True) if(sidelen[0]**2 == sidelen[1]**2 + sidelen[2]**2): print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
82
2
n = int(input()) for i in range(n): e = sorted(map(int, input().split())) if e[2] * e[2]== e[0] * e[0] + e[1] * e[1]: print("Yes") else: print("No")
n = int(input()) for i in range(n): e = sorted(map(int, input().split())) if e[2] * e[2]== e[0] * e[0] + e[1] * e[1]: print("YES") else: print("NO")
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
78
4
N = int(input()) for i in range(N): line = raw_input() l = [None]*3 l[0] = int(line.split()[0]) l[1] = int(line.split()[1]) l[2] = int(line.split()[2]) l.sort() if l[0]**2+l[1]**2==l[2]**2: print("YES") else: print("NO")
N = int(input()) for i in range(N): line = input() l = [None]*3 l[0] = int(line.split()[0]) l[1] = int(line.split()[1]) l[2] = int(line.split()[2]) l.sort() if l[0]**2+l[1]**2==l[2]**2: print("YES") else: print("NO")
[["-", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22]]
5
117
2
def main(): data_count = int(input()) data = [tuple(map(int, input().split())) for i in range(data_count)] for item in data: print('YES') if item[0]**2 + item[1]**2 == item[2]**2 else print('NO') main()
def main(): data_count = int(input()) data = [list(map(int, input().split())) for i in range(data_count)] for item in data: item.sort() print('YES') if item[0]**2 + item[1]**2 == item[2]**2 else print('NO') main()
[["-", 0, 1, 0, 662, 12, 658, 8, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 658, 8, 652, 63, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 0, 131], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
81
7
def main(): n = int(input()) for i in range(n): Array = list(map(int,input().split())) Array.sort() if Array[2]**2 == Array[0]**2 + Array[1]**2: print("YES") else: print("No") if __name__ == '__main__': main()
def main(): n = int(input()) for i in range(n): Array = list(map(int,input().split())) Array.sort() if Array[2]**2 == Array[0]**2 + Array[1]**2: print("YES") else: print("NO") if __name__ == '__main__': main()
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
89
2
for _ in range(int(input())): l = list(map(int, input().split())) l.sort() print('YES' if l[0]**2 + l[1] ** 2 == l[2] ** 2 else 'No')
for _ in range(int(input())): l = list(map(int, input().split())) l.sort() print('YES' if l[0]**2 + l[1] ** 2 == l[2] ** 2 else 'NO')
[["-", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 41, 0, 557, 0, 6]]
5
66
2
for _ in[0]*int(input()): a,b,c=map(int,sorted(input().split())) print(['No','Yes'][a*a+b*b==c*c])
for _ in[0]*int(input()): a,b,c=sorted(map(int,input().split())) print(['NO','YES'][a*a+b*b==c*c])
[["+", 8, 196, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["-", 0, 662, 12, 652, 3, 4, 0, 652, 63, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 3, 4, 0, 206, 51, 634, 0, 557, 0, 6], ["+", 3, 4, 0, 206, 51, 634, 0, 557, 0, 6]]
5
60
8
import sys for a,b,c in map(lambda x:sorted(map(int,x.split())),sys.stdin): print(['NO','YES'][a*a+b*b==c*c])
import sys input() for a,b,c in map(lambda x:sorted(map(int,x.split())),sys.stdin): print(['NO','YES'][a*a+b*b==c*c])
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
58
3
import sys for e in sys.stdin: a, b, c = sorted(map(int, e.split())) if a**2 + b**2 == c**2: print('YES') else: print('NO')
import sys input() for e in sys.stdin: a, b, c = sorted(map(int, e.split())) if a**2 + b**2 == c**2: print('YES') else: print('NO')
[["+", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
55
3
N = int(input()) for i in range(N): a = list(map(int, input().split(" "))) a.sort #print(a) if(a[2]**2 == a[0]**2 + a[1]**2): print("YES") else: print("NO")
# AOJ通らなかった...何故かはわからん N = int(input()) for i in range(N): a = list(map(int, input().split(" "))) a.sort() #print(a) if(a[2]**2 == a[0]**2 + a[1]**2): print("YES") else: print("NO")
[["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
78
2
for i in range(int(input())): llist = list(map(int,input().split())) llist.sort() if(llist[2]**2 == llist[0]**2 + llist[1]**2): print('Yes') else: print('No')
for i in range(int(input())): llist = list(map(int,input().split())) llist.sort() if(llist[2]**2 == llist[0]**2 + llist[1]**2): print('YES') else: print('NO')
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6]]
5
73
4