摘要: ####1. 生产者-消费者问题(互斥+同步) 生产者把消息放入缓冲区,消费者从中取出信息,二者互斥访问 semaphore mutex = 1;//互斥访问缓冲区,因为有多个缓冲区资源 semaphore empty = n;//n个空闲区资源,内部互斥 semaphore full = 0;// 阅读全文
posted @ 2022-08-28 01:52 失控D大白兔 阅读(40) 评论(0) 推荐(0) 编辑
摘要: ####1. 返回尾零数量 可以转换为求质因子为2和5数量的较小值,实际上就是求质因子为5的数量 class Solution { public: int trailingZeroes(int n) { int ans = 0; for (int i = 5; i <= n; i += 5) //遍 阅读全文
posted @ 2022-08-28 00:32 失控D大白兔 阅读(15) 评论(0) 推荐(0) 编辑