title: woj1019 Curriculum Schedule 输入输出 date: 2020-03-19 10:43:00 categories: acm tags: [acm,woj] 水题,处理好输入输出就可以 1 描述 New semester has begun, a lot of students are going to print out their curriculum schedules. They are using the same template, as the…
已排序数据的算法 Binary search, merge, set operations 每个已排序数据算法都有一个同名的更一般的形式 vector vec = {8,9,9,9,45,87,90}; // 7 items 1. 二分法搜索 // 搜索元素 bool found = binary_search(vec.begin(), vec.end(), 9); vector<int> s = {9, 45, 66}; bool found = includes(vec.begin(),…
STL概貌                                                                                                STL 包含 5 个主要的部分 ·算法(Algorithm):能运行在不同容器(container)上的计算过程 ·容器(Container):能够保留并管理对象的对象 ·迭代器(Iterator):算法存取容器(algorithm-access to containers)的抽象,以便算法可以应…
reference url:http://www.cplusplus.com/reference/algorithm reference url:https://blog.csdn.net/Swust_Zeng_zhuo_K/article/details/80113384 <algorithm> Standard Template Library: Algorithms The header <algorithm> A range is any sequence of objec…
零散知识点: 非格式化输入输出:getchar().putchar() 格式化输入输出   :scanf().printf() 字符串输入输出   :gets() 或 scanf().puts() 或 printf(). gets()函数以换行符或文件结束符EOF作为输入的结束标志,因此,在输入的字符串中允许包含空格或制表符. scanf()函数则以空格.制表符.换行符和文件结束符EOF作为输入的结束标志,因此,在输入的字符串中不允许包含这些字符. puts()函数在字符串显示完毕后换行. pr…
1040: Schedule Time Limit: 500 MS  Memory Limit: 64 MBSubmit: 12  Solved: 2[Submit][Status][Web Board] Description Resently, loneknight is doing research on job shop schedule problem(JSP for short). Let us take a look at JSP, there are n jobs and m m…
和LeetCode 207. Course Schedule(拓扑排序-求有向图中是否存在环)类似. 注意到.在for (auto p: prerequistites)中特判了输入中可能出现的平行边或自环. 代码: class Solution { public: vector<int> findOrder(int numCourses, vector<pair<int, int>>& prerequisites) { // [0, {1, 2, 3}], me…
Age Sort You are given the ages (in years) of all people of a country with at least 1 year of age. You know that no individual in that country lives for 100 or more years. Now, you are given a very simple task of sorting all the ages in ascending ord…
题目 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and…
Task schedule Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 515 Accepted: 309 Special Judge Description There are n preemptive jobs to be processed on a single machine. Each job j has a processing time pj and deadline dj. Preemptive cons…