本文分享的必刷题目是从蓝桥云课、洛谷、AcWing等知名刷题平台精心挑选而来并结合各平台提供的算法标签和难度等级进行了系统分类。题目涵盖了从基础到进阶的多种算法和数据结构旨在为不同阶段的编程学习者提供一条清晰、平稳的学习提升路径。欢迎大家订阅我的专栏算法题解C与Python实现附上汇总贴算法竞赛备考冲刺必刷题C | 汇总【题目来源】AtCoderA - Product Quality Evaluation【题目描述】Takahashi is in charge of quality control at a factory. This factory manufacturesN NNtypes of products, each numbered from1 11toN NN.高桥负责一家工厂的质量控制工作。这家工厂生产N NN种产品每种产品编号从1 11到N NN。Each product has two metrics: a “quality index” and a “production quantity.” The quality index of producti iiisA i A_iAi​, and its daily production quantity isB i B_iBi​units. A higher quality index indicates that defective items are more likely to occur.每种产品有两个指标“质量指数和生产数量”。产品i ii的质量指数为A i A_iAi​其日生产数量为B i B_iBi​单位。质量指数越高表明次品出现的可能性越大。Takahashi decided to calculate a “risk score” for each product. The risk score of producti iiis defined as the product of the quality indexA i A_iAi​and the production quantityB i B_iBi​, namelyA i × B i A_i \times B_iAi​×Bi​. A higher risk score means that more attention is required for that product.高桥决定为每种产品计算一个风险分数。产品i ii的风险分数定义为质量指数A i A_iAi​与生产数量B i B_iBi​的乘积即A i × B i A_i × B_iAi​×Bi​。风险分数越高意味着该产品需要更多关注。Takahashi believes that products with a risk score ofK KKor higher need to be prioritized for improvement. Find the number of products whose risk score isK KKor higher.高桥认为风险分数为K KK或更高的产品需要优先进行改进。求风险分数为K KK或更高的产品数量。【输入】N NNK KKA 1 A_1A1​B 1 B_1B1​A 2 A_2A2​B 2 B_2B2​⋮ \vdots⋮A N A_NAN​B N B_NBN​The first line contains an integerN NNrepresenting the number of product types and an integerK KKrepresenting the risk score threshold, separated by a space.From the 2nd line to the( N 1 ) (N1)(N1)-th line, information about each product is given.The( i 1 ) (i1)(i1)-th line( 1 ≤ i ≤ N ) (1 \leq i \leq N)(1≤i≤N)contains the quality indexA i A_iAi​and the production quantityB i B_iBi​of producti ii, separated by a space.【输出】Output the number of products whose risk score isK KKor higher, in a single line.【输入样例】3 100 10 5 20 10 5 30【输出样例】2【解题思路】【算法标签】#模拟#【代码详解】#includebits/stdc.husingnamespacestd;#defineintlonglongintn,k,ans;// n: 商品数量k: 目标金额ans: 计数signedmain(){cinnk;// 读入商品数量和目标金额for(inti1;in;i){inta,b;// a: 单价b: 数量cinab;// 读入单价和数量if(a*bk)// 如果总价大于等于目标金额k{ans;// 计数器加1}}coutansendl;// 输出满足条件的商品数量return0;}【运行结果】3 100 10 5 20 10 5 30 2