admin 管理员组文章数量: 887021
2024年1月19日发(作者:浮点数输入格式)
答案:39000代码:
if (1 == x) s[1] = 2; if (1 == y) s[0] = 2; } return s; } static long[] end_p(long x, long y, boolean r) { long[] s = start_p(x, y, r); return new long[] { 2 - s[0], 2 - s[1] }; } static long f(long k, long[] p0, long[] p1, boolean r) { long len = ((3, k - 1)); long dist = 0; long[] np0 = new long[] { p0[0] / len, p0[1] / len }; long[] np1 = new long[] { p1[0] / len, p1[1] / len }; dist += dis[r ? 2 - (int) np0[0] : (int) np0[0]][(int) np0[1]][r ? 2 - (int) np1[0] : (int) np1[0]][(int) np1[1]]; dist = dist < 0 ? -dist : dist; if (1 == k) { return dist; } else --dist; dist *= ((3, k - 1)); dist *= ((3, k - 1)); long[] nnp0 = new long[] { p0[0] % len, p0[1] % len }; long[] nnp1 = new long[] { p1[0] % len, p1[1] % len }; if (true) { boolean rr = is_reverse(nnp0[0], nnp0[1], r); dist += f(k - 1, nnp0, end_p(np0[0], np0[1], rr), rr) + 1; } if (true) { boolean rr = is_reverse(nnp1[0], nnp1[1], r); dist += f(k - 1, start_p(np1[0], np1[1], rr), nnp1, rr); } return dist; } public static void main(String[] args) { Scanner sc = new Scanner(); // long n = ng(); boolean arr[][] = new boolean[4][4]; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { for (int ii = 0; ii < 3; ++ii) { for (int jj = 0; jj < 3; ++jj) { dis[i][j][ii][jj] = dd[ii + jj * 3] - dd[i + j * 3]; // ("%d,%d,%d,%d=>%dn", i, j, ii, jj, // dis[i][j][ii][jj]); } } } } long k = ng(); long[] p0 = new long[] { ng(), ng() }; long[] p1 = new long[] { ng(), ng() }; long dist = f(k, p0, p1, false); n(dist); }}
// 完美过样例。import lFormat;import .*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(); DecimalFormat fmt = new DecimalFormat("#.00"); // long n = ng(); int l = t(); int r = t(); int d = t(); int w = t(); int[] la = new int[l]; int[] ra = new int[r]; for (int i = 0; i < l; ++i) { la[i] = t(); } for (int i = 0; i < r; ++i) { ra[i] = t(); } int li = 0; int ri = 0; double sx = (double) w / 2; double sy = 0.0; double dist = 0; while (li < l || ri < r) { double ld = _VALUE, rd = _VALUE; if (li < l) { double x = sx - 0; double y = sy - la[li]; ld = (x * x + y * y); } if (ri < r) { double x = sx - w; double y = sy - ra[ri]; rd = (x * x + y * y); } if (ld < rd) { dist += ld; sy = la[li]; sx = 0; ++li; } else { dist += rd; sy = ra[ri]; sx = w; ++ri; } } { double x = sx - (double) w / 2; double y = sy - d; dist += (x * x + y * y); } n((dist)); }
版权声明:本文标题:2020第十一届蓝桥杯软件类JavaB组决赛(国赛)题目+个人答案 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1705612891h492401.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论