PKU 1161、PKU 2524、 PKU 1308

自动化测试实战项目开发 - 用例发现装载、参数化数据驱动、断言账本、Mock桩与虚拟被测对象、覆盖率统计、结果聚合与报告生成,43源文件185用例 主机侧可跑的自动化测试框架纯源码工程:用例发现与装载 / 参数化与数据驱动 / 断言账本 / Mock 桩与虚拟被测对象 / 覆盖率统计 / 结果聚合与报告生成(43 个 src 源文件 7596 非空行 / 185 用例 1176 断言全绿 / 非真实被测系统实测) 这份资料解决一个很具体的问题:机器上没有真实被测系统,怎么把一套自动化测试框架写对,并且证明它是对的。答案不是先接一堆外部依赖,而是把框架拆成显式、可单测、可主机侧运行的纯源码工程:core 层给出常量、异常、确定性工具、虚拟时钟、数据模型与断言账本,runner 层负责发现、装载、参数化、夹具与执行状态机,mock 层提供 Mock、桩、间谍、补丁与虚拟被测对象,report 层把结果算成覆盖率、聚合、汇总与三种报告,cli 层把四层能力串成四个子命令与二十一项分层自检。全册 43 个 src 源文件里的代码就是这套实现的全部,正文里的每一行都与工程里的文件逐字节一致。 全册 63 个 .py 文件、9,430 个非空行(总行 11,393)分五层再加脚本与测试:core 10 个 2,125 行、runner 11 个 1,804 行、mock 9 个 1,727 行、report 8 个 1,207 行、cli 5 个 733 行、scripts 与 tests 共 20 个 1,834 行。每层都能单独读懂,合起来是一条从「给一组名字做发现」到「装载派生、逐用例执行、收集断言账本、按虚拟被测对象打点算覆盖率、聚合结果、渲染三种报告」的完整链路。所有用例、参数、故障、覆盖率打点都由代码现场构造在内存里,因此同一份工程在任意装有 CPython 3.9 的机器上都能复算出同样的数值。 立即下载

 

-----------------------------------例题一---------------------------------------
The Suspects
Time Limit: 1000MS		Memory Limit: 20000K
Total Submissions: 12013		Accepted: 5694
Description
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others. 
In the Not-Spreading-Your-Sickness University (NSYSU), there are many student groups. Students in the same group intercommunicate with each other frequently, and a student may join several groups. To prevent the possible transmissions of SARS, the NSYSU collects the member lists of all student groups, and makes the following rule in their standard operation procedure (SOP). 
Once a member in a group is a suspect, all members in the group are suspects. 
However, they find that it is not easy to identify all the suspects when a student is recognized as a suspect. Your job is to write a program which finds all the suspects.
Input
The input file contains several cases. Each test case begins with two integers n and m in a line, where n is the number of students, and m is the number of groups. You may assume that 0 < n <= 30000 and 0 <= m <= 500. Every student is numbered by a unique integer between 0 and n−1, and initially student 0 is recognized as a suspect in all the cases. This line is followed by m member lists of the groups, one line per group. Each line begins with an integer k by itself representing the number of members in the group. Following the number of members, there are k integers representing the students in this group. All the integers in a line are separated by at least one space. 
A case with n = 0 and m = 0 indicates the end of the input, and need not be processed.
Output
For each case, output the number of suspects in one line.
Sample Input
100 4
2 1 2
5 10 13 11 12 14
2 0 1
2 99 2
200 2
1 5
5 1 2 3 4 5
1 0
0 0
Sample Output
4
1
1
Source
/* --------------代码------------*/
#include<iostream>
using namespace std;

int i, j, n, m;
int father[30005], num[30005];

void MakeSet( int n )
{
    for( i = 0; i < n; i ++ )
    {
        father[i] = i;
        num[i] = 1;
    }
}

int find( int x )
{
    if( x != father[x] )
        father[x] = find( father[x] );
    return father[x];
}

void Union( int a, int b )
{
    int x = find( a );
    int y = find( b );
    if( x == y )
        return;
    if( num[x] < num[y] )
    {
        father[x] = y; // y的子节点多,所以x的父节点归结于y;
        num[y] += num[x];
    }
    else
    {
        father[y] = x;
        num[x] += num[y];
    }
}

int main()
{
    while( cin >> n >> m && n )
    {
        MakeSet( n );
        for( i = 0; i < m; i ++ )
        {
            int count, first, b;
            cin >> count >> first;
            for( j = 1; j < count; j ++ )
            {
                cin >> b;
                Union( first, b );
            }
        }
        cout << num[find(0)] << endl;
    }
    return 0;
}
-----------------------------------------例题2-------------------------------------
Is It A Tree?
Time Limit: 1000MS		Memory Limit: 10000K
Total Submissions: 12034		Accepted: 4125
Description
A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. 

There is exactly one node, called the root, to which no directed edges point. 
Every node except the root has exactly one edge pointing to it. 
There is a unique sequence of directed edges from the root to each node. 
For example, consider the illustrations below, in which nodes are represented by circles and edges are represented by lines with arrowheads. The first two of these are trees, but the last is not. 
 

In this problem you will be given several descriptions of collections of nodes connected by directed edges. For each of these you are to determine if the collection satisfies the definition of a tree or not. 
Input
The input will consist of a sequence of descriptions (test cases) followed by a pair of negative integers. Each test case will consist of a sequence of edge descriptions followed by a pair of zeroes Each edge description will consist of a pair of integers; the first integer identifies the node from which the edge begins, and the second integer identifies the node to which the edge is directed. Node numbers will always be greater than zero. 
Output
For each test case display the line "Case k is a tree." or the line "Case k is not a tree.", where k corresponds to the test case number (they are sequentially numbered starting with 1). 
Sample Input
6 8  5 3  5 2  6 4
5 6  0 0

8 1  7 3  6 2  8 9  7 5
7 4  7 8  7 6  0 0

3 8  6 8  6 4
5 3  5 6  5 2  0 0
-1 -1
Sample Output
Case 1 is a tree.
Case 2 is a tree.
Case 3 is not a tree.
Source
/*--------------代码----------------*/
#include<iostream>
using namespace std;
#define MAXN 10001
int f[MAXN], mark[MAXN], r[MAXN];

int find( int x )
{
    if( x != f[x] )
        f[x] = find( f[x] );
    return f[x];
}

int dec()
{
    int t, i;
    for( i = 1; i < MAXN; i ++ )
        if( mark[i])
            ++r[find(i)];
    t = 0;
    for( i = 1; i < MAXN; i ++ )
        if( r[i] > 1 )
            t ++;
    if( t > 1 )
        return 0;
    else
        return 1;
}
int main()
{
    int x, y, i, a, b, c = 0;
    while( 1 )
    {
        for( i = 1; i < MAXN; i ++ )
            f[i] = i, mark[i] = 0, r[i] = 0;
        int flag = 0;
        while ( cin >> a >> b )
        {
            if( ( a == 0 && b == 0) || a < 0 )
                break;
            x = find(a);
            y = find(b);
            mark[a] = mark[b] = 1;
            if( x == y || b != y )
                flag = 1;
            else f[b] = a;
        }
        if( a < 0 )
            break;
        if( flag )
            cout << "Case " << ++c << " is not a tree." << endl;
        else
        {
            if( dec() )
                cout << "Case " << ++c << " is a tree." << endl;
            else
                cout << "Case " << ++c << " is not a tree." << endl;
        }
    }
    return 0;
}
//------------------------ 例题3-----------------------------
Ubiquitous Religions
Time Limit: 5000MS		Memory Limit: 65536K
Total Submissions: 15006		Accepted: 7167
Description
There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university believe in. 

You know that there are n students in your university (0 < n <= 50000). It is infeasible for you to ask every student their religious beliefs. Furthermore, many students are not comfortable expressing their beliefs. One way to avoid these problems is to ask m (0 <= m <= n(n-1)/2) pairs of students and ask them whether they believe in the same religion (e.g. they may know if they both attend the same church). From this data, you may not know what each person believes in, but you can get an idea of the upper bound of how many different religions can be possibly represented on campus. You may assume that each student subscribes to at most one religion. 
Input
The input consists of a number of cases. Each case starts with a line specifying the integers n and m. The next m lines each consists of two integers i and j, specifying that students i and j believe in the same religion. The students are numbered 1 to n. The end of input is specified by a line in which n = m = 0. 
Output
For each test case, print on a single line the case number (starting with 1) followed by the maximum number of different religions that the students in the university believe in.
Sample Input
10 9
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
10 4
2 3
4 5
4 8
5 8
0 0
Sample Output
Case 1: 1
Case 2: 7
Hint
Huge input, scanf is recommended.
Source
//---------------------代码----------------------------
#include<iostream>
using namespace std;

int n, m, maxNum, i;
int father[50005], num[50005];

void MakeSet( int n )
{
    for( i = 0; i < n; i ++ )
    {
        father[i] = i;
        num[i] = 1;
    }
}

int find( int x )
{
    if( x != father[x] )
        father[x] = find( father[x] );
    return father[x];
}

void Union( int a, int b )
{
    int x = find( a );
    int y = find( b );
    if( x == y )
        return ;
    if( num[x] < num[y] )
    {
        father[x] = y;
        num[y] += num[x];
        maxNum --;
    }
    else
    {
        father[y] = x;
        num[x] += num[y];
        maxNum --;
    }
}

int main()
{
    int Case = 1;
    while( cin >> n >> m && n || m )
    {
        maxNum = n;
        MakeSet( n );
        int a, b;
        for( i = 0; i < m ; i ++ )
            {
                cin >> a >> b;
                Union( a, b );
            }
        cout << "Case " << Case ++ << ": " << maxNum << endl;
    }
    return 0;
}


 

chrome-headless-shell-mac-arm64-160.0.8182.0(Canary).zip Chrome for Testing 官方测试构建包,内含 Chrome 浏览器、ChromeDriver 与 Chrome Headless Shell,适用于对应平台的自动化测试、Selenium/Playwright 驱动与 CI 环境搭建。解压即用,请按文件名中的平台选择对应版本。 立即下载

相关推荐

地方政府在引进高端创新联合体落地时,通常有哪些税收或土地配套政策?.docx

科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。

杭电DP题目(dynamic programming)

<br />这里集中了很多的动态规划题目,我也从这里开始突破啦<br />----------------------------------------------------------------------------------------------<br /> <br />   记我今天开始,正式向ACM营地出发,努力搞好自己的CSDN博客<br /> <br />                                turn potential to reality !<br />

小do在努力 2569

大型国企构建供应链创新联合体,协同研发管理为何仍是瓶颈?.docx

科易网基于行业知识库+行业大数据+科技资源要素+AI模型,以AI,赋能技术转移、成果转化、技术经理人培训、知识产权管理、区域产业分析与布局、地方科技招商、创新创业大赛等场景,推出科技创新领域的AI工具、场景化服务和数智化解决方案,推动科技创新与产业创新智能化发展。

HDU 1312 Red and Black

看了好多天的DFS,基本上的程序都是要借助解题报告才可以实现 但是这一题,确实依照自己的思路,完全靠自己写出来的,或许比较简单吧,所以特此发表下文章,犒劳一下自己,再接再厉 http://acm.hdu.edu.cn/showproblem.php?pid=1312 Red

小do在努力 2548

Adobe Illustrator 2025 29.6.0.207 m0nkrus.zip.part001

Adobe Illustrator 2025 29.6.0.207 m0nkrus.zip.part001

从USB相机标定到Aruco码精准定位:基于aruco-ros的机器人视觉实践

本文详细介绍了基于aruco-ros的机器人视觉实践,从USB相机标定到Aruco码精准定位的全流程。通过实战案例和优化技巧,展示了Aruco码在机器人导航中的高精度位姿识别能力,帮助开发者快速实现毫米级视觉定位系统。

weixin_27310417的博客 492

杭电1051 经典贪心

这题真是抓狂,我已经提交了8次,还是没过,我都找不到任何错误数据了粘贴下别人的代码提交下,就是果断过。。。求大牛指点……/* title:Wooden Sticks url: http://acm.hdu.edu.cn/showproblem.php?pid=1051 我的做题思想: 主要是通过下表法,首先对数组的length按从小到大排序 然后,通过第一元素开始,进行比较,如果后面的任一 一组数据与当前数据进行比较,length和weight都比目前 length 和 weight 都小

小do在努力 2126

别再傻傻分不清了!Anaconda和Miniconda到底选哪个?附保姆级安装与镜像源配置(Windows/Mac)

本文详细解析了Anaconda和Miniconda的核心差异,包括体积、预装内容、系统资源占用等关键维度,并提供了针对不同需求的决策框架。附有Windows和Mac双平台的详细安装与配置指南,帮助用户根据实际需求选择最适合的conda工具,提升开发效率。

weixin_30315723的博客 432

Uva 10104 Euclid Problem |x|+|y|最小解 扩展欧几里得

/* * url: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1045 * stratege: 求ax+by=gcd(a,b), |x|+|y|的和的x,y,的解, 扩展欧几里得,分四种情况考虑 * status:10541367 1010

小do在努力 2114

Microsoft Defender防病毒扫描添加排除项

Win10与Win11上的“**Microsoft Defender防病毒**”功能默认会自动扫描所有非压缩文件,如果发现病毒或疑似病毒甚至经过手动修改后某些安装文件,会自动将其删除,如果是后面两种情况,则可能会造成误报,对我们正常办公或学习造成不利影响。 此时, 我们可以将某个目录或文件设置为“**Microsoft Defender防病毒不会扫描已排除的项目**”(<red>但要注意:这些被排除的目录或文件会给笔记本造成一定的安全风险,如果真有病毒感染这些目录或文件它们也不会被“**Micr

weixin_42148668的博客 6493

【CTFWP】ctfshow-web40

CTFWP:ctfshow-web40

LongL_GuYu的博客 1866

hdu 1930 And Now, a Remainder from Our Sponsor 扩展欧几里得 解一元线性同余方程组

/** * url : http://acm.hdu.edu.cn/showproblem.php?pid=1930 * stratege : 解一元线性同余方程组, 扩展欧几里得 * Author: johnsondu * Status: johnsondu 0MS 284K 2207B C++ 2012-08-19 13:13:15 * Trick: There will be n

小do在努力 2038

51单片机定时器的原理、应用与编程实现

本文系统介绍了51单片机定时器的基本原理与应用。首先阐述了定时器的工作原理,包括定时模式和计数模式的区别。然后详细讲解了定时器的四种工作模式(方式0-方式3)及其适用场景,并分析了相关寄存器(TMOD、TCON、THx/TLx)的功能设置。文章还给出了定时器编程的具体步骤,包括初始化、计数初值计算和示例代码。最后通过LED闪烁、PWM波形产生、脉冲计数等实际应用案例,展示了定时器的多样化应用。掌握这些知识对嵌入式系统开发具有重要意义。

2501_91227323的博客 1528

LightOj 1111 - Best Picnic Ever

/** * Author: johnsondu * time: 2013-4-11 * problem: LightOj 1111 - Best Picnic Ever * url: http://lightoj.com/volume_showproblem.php?problem=1111 * stratege: DFS, count the person who can r

小do在努力 1885

用 ABAP CDS View 把数据稳定抽到 SAP BW/4HANA:从 ODP 架构到增量机制的落地实践

本文探讨了SAP数据仓库中从业务系统抽取数据到SAP BW/4HANA的最佳实践,重点分析了基于ABAP CDS视图的抽取方法。文章指出CDS视图通过注解可实现元数据描述、增量机制的统一管理,替代传统抽取器。详细介绍了ODP架构如何作为抽取基础设施,以及从CDS到BW的完整链路。同时比较了三种增量抽取方式(BW管理时间戳、ODP通用增量、CDC触发器)的适用场景和注意事项,并强调版本兼容性和云环境连接差异对实施的影响。通过实际案例说明合理选择增量策略对数据仓库稳定性的重要性。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 333

基于深度学习的CT图像肺结节分割与检测系统[完整代码数据分享]

基于深度学习的CT图像肺结节分割与检测系统[完整代码数据分享]

283

POJ 3641 HDU 1905 Pseudoprime numbers 素数 模取幂

/* --------------------------------------------------- status : a312745658 3641 Accepted 328K 16MS C++ 1732B 2012-05-18 21:36:37 stratege : 快速模取幂,素数筛选, 判断一个大数是否为素数 URL: http:

小do在努力 1815

redhawk:STA timing data file解析

我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?STA timing data file分为以下几个部分:• Header• Name Map• Footer这部分报告设计的基本信息,例如文件类型,设计名称,分隔符等。...

m0_61544122的博客 1168

HDU 1211 RSA 逆元 快速模取幂

/** * url: http://acm.hdu.edu.cn/showproblem.php?pid=1211 RSA * Author: Johnsondu * Time: 2012-7-28 18:00 around * Stratege: 逆元(扩展欧几里德) , 快速模取幂 * Status: 6364213 2012-07-28 18:12:54 Accepte

小do在努力 1733

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

HDU 1010 Tempter of the Bone

关于DFS如何学好,先援引大牛的几点建议: (1)先理解搜索的原理,区别好bfs和dfs的优先搜索方向以及应用,例如bfs一般用来求最优解如最短路径. (2)掌握好所用的数据结构,特别是队列. (3)牢记dfs和bfs的常用模式,它是基本固定的,考试时信手拈来! (4)注

小do在努力 1682

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

LightOj 1054 Efficient Pseudo Code

/* * Author: johnsondu * time: 2013-4-25 * meanning: 求出约数和n ^ m的约数和,快速模取幂,扩展欧几里德,素数筛选 * problem: LightOj 1054 * url: http://lightoj.com/volume_showproblem.php?problem=1054 * */ #include #i

小do在努力 1655

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

uva 10830 A New Function

/* * Author: johnsondu * time: 2013-4-25 * problem: uva 10830 - A New Function * url: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1771 * so

小do在努力 1641

Uva 11395 - Sigma Function 规律 对数

/* * 规律:通过打表后发现,在n的范围内,只有2^x 以及 平方数 和 平方数的2倍符合要求。 * 即:2^1, 2^2,... 1*1, 2*2,... 2*1*1, 2*2*2, 2*3*3... 等等,故只要去重就可以了 * url: http://uva.onlinejudge.org/index.php?option=onlinejudge&page=show_p

小do在努力 1637

HDU 1559 最大子矩阵

/** * Author : johnsondu * time : 2013-4-7 * Type: DP, I want to really understand it * problem: 最大子矩阵 * url: http://acm.hdu.edu.cn/showproblem.php?pid=1559 */ #include #include #include

小do在努力 1629

NYOJ38 布线问题 prim算法 kruscal算法

/* problem : NYOJ38 布线问题 stratege: kruscal algorithm URL :http://acm.nyist.net/JudgeOnline/problem.php?pid=38 status :166386 1006100213 布线问题 Accepted 76 4216 C/C++ 05-13 21:57:42 */

小do在努力 1500

POJ 3070 Fibonacci 矩阵乘法 整数分解

#include #include #include #include #include using namespace std ; int a[100][2][2] ; int n, base[30], len; void init () // 此处主要用于计算当n=1,2,4,8,16...f[n]的值,此时对应的k为0,1,2,3,... { a[0][0][0] =

小do在努力 1447
上一篇: 01背包,完全背包, 多重背包
下一篇: HDU 1010 Tempter of the Bone
小do在努力
博客等级 码龄16年 58粉丝 161原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址