深圳航空公司订票电话优化方案官方网站
2026/4/16 23:58:07 网站建设 项目流程
深圳航空公司订票电话,优化方案官方网站,营销型网站建设原则,对网页美工的认识(100分)- 测试用例执行计划#xff08;Java JS Python C#xff09; 题目描述 某个产品当前迭代周期内有 N 个特性#xff08;F1,F2,......FN#xff09;需要进行覆盖测试#xff0c;每个特性都被评估了对应的优先级#xff0c;特性使用其 ID 作为下…(100分)- 测试用例执行计划Java JS Python C题目描述某个产品当前迭代周期内有 N 个特性F1,F2,......FN需要进行覆盖测试每个特性都被评估了对应的优先级特性使用其 ID 作为下标进行标识。设计了 M 个测试用例T1,T2,......,TM每个测试用例对应一个覆盖特性的集合测试用例使用其 ID 作为下标进行标识测试用例的优先级定义为其覆盖的特性的优先级之和。在开展测试之前需要制定测试用例的执行顺序规则为优先级大的用例先执行如果存在优先级相同的用例用例 ID 小的先执行。输入描述第一行输入为 N 和 MN 表示特性的数量0 N ≤ 100M 表示测试用例的数量0 M ≤ 100之后 N 行表示特性 ID1 到特性 IDN 的优先级再接下来 M 行表示测试用例 ID1 到测试用例 IDM 关联的特性的 ID 的列表。输出描述按照执行顺序优先级从大到小输出测试用例的 ID每行一个ID。测试用例覆盖的 ID 不重复。用例输入5 4112351 2 31 43 4 52 3 4输出3412说明测试用例的优先级计算如下T1 Pf1 Pf2 Pf3 1 1 2 4T2 Pf1 Pf4 1 3 4T3 Pf3 Pf4 Pf5 2 3 5 10T4 Pf2 Pf3 Pf4 1 2 3 6按照优先级从小到大以及相同优先级ID小的先执行的规则执行顺序为T3,T4,T1,T2输入3 33151 2 31 2 31 2 3输出123说明测试用例的优先级计算如下T1 Pf1 Pf2 Pf3 3 1 5 9T2 Pf1 Pf2 Pf3 3 1 5 9T3 Pf1 Pf2 Pf3 3 1 5 9每个优先级一样按照 ID 从小到大执行执行顺序为T1,T2,T3题目解析简单的自定义排序问题。JS算法源码const rl require(readline).createInterface({ input: process.stdin }); var iter rl[Symbol.asyncIterator](); const readline async () (await iter.next()).value; void (async function () { const [n, m] (await readline()).split( ).map(Number); const features new Array(n 1); for (let i 1; i n; i) { features[i] parseInt(await readline()); } const cases []; for (let i 1; i m; i) { const priority (await readline()) .split( ) .map((id) features[id - 0]) // id-0是为了将字符串id转为数值id .reduce((a, b) a b); cases.push([priority, i]); } cases .sort((a, b) (a[0] ! b[0] ? b[0] - a[0] : a[1] - b[1])) .forEach(([_, id]) console.log(id)); // forEach入参使用了数组解构语法 })();Java算法源码import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { static class TestCase { int id; int priority; public TestCase(int id, int priority) { this.id id; this.priority priority; } } public static void main(String[] args) { Scanner sc new Scanner(System.in); int[] tmp Arrays.stream(sc.nextLine().split( )).mapToInt(Integer::parseInt).toArray(); int n tmp[0]; int m tmp[1]; int[] features new int[n 1]; for (int i 1; i n; i) { features[i] Integer.parseInt(sc.nextLine()); } ArrayListTestCase cases new ArrayList(); for (int i 1; i m; i) { int priority Arrays.stream(sc.nextLine().split( )) .map(Integer::parseInt) .map(id - features[id]) .reduce(Integer::sum) .orElse(0); cases.add(new TestCase(i, priority)); } cases.stream() .sorted((a, b) - a.priority ! b.priority ? b.priority - a.priority : a.id - b.id) .map(testcase - testcase.id) .forEach(System.out::println); } }Python算法源码# 输入获取 n, m map(int, input().split()) features [0] * (n 1) for i in range(1, n1): features[i] int(input()) cases [] for i in range(1, m1): priority sum(map(lambda x: features[int(x)], input().split())) cases.append([priority, i]) cases.sort(keylambda x: (-x[0], x[1])) for _, idx in cases: print(idx)C算法源码#include stdio.h #include stdlib.h typedef struct { int priority; int id; } TestCase; TestCase *new_TestCase(int id) { TestCase *testcase (TestCase *) malloc(sizeof(TestCase)); testcase-priority 0; testcase-id id; return testcase; } int cmp(const void *a, const void *b) { TestCase *A *((TestCase **) a); TestCase *B *((TestCase **) b); return A-priority ! B-priority ? B-priority - A-priority : A-id - B-id; } int main() { int n, m; scanf(%d %d, n, m); int features[n 1]; for (int i 1; i n; i) { scanf(%d, features[i]); } TestCase *cases[m]; for (int i 0; i m; i) { cases[i] new_TestCase(i 1); int feature_id; while (scanf(%d, feature_id)) { cases[i]-priority features[feature_id]; if (getchar() ! ) break; } } qsort(cases, m, sizeof(TestCase *), cmp); for (int i 0; i m; i) { printf(%d\n, cases[i]-id); } return 0; }

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询