摘要: 解 借助优先队列。 钥匙盒的状态是由老师拿走与放回的操作改变的,每一次输入的w, s, c都包含着两个时刻,s和s+c时刻(放回和归还的时间)。 钥匙盒的变化是随着时间从早到晚来改变的,所以遍历操作改变的时候,时间需要从小到大出现。 如果同一时刻既有老师还钥匙又有老师取钥匙,则老师们会先将钥匙全还回 阅读全文
posted @ 2021-04-09 15:39 沃特艾文儿 阅读(23) 评论(0) 推荐(0)
摘要: 解 遍历判断左右与其满足关系 int judge(int x, int y, int z) { return (x < y && x < z) || (x > y && x > z); } // // Created by 29273 on 2021-04-02. // #include "bits 阅读全文
posted @ 2021-04-09 15:21 沃特艾文儿 阅读(19) 评论(0) 推荐(0)
摘要: 解 基本操作,不多说 // // Created by 29273 on 2021-04-02. // #include "bits/stdc++.h" using namespace std; int main() { int n, num = 0; cin >> n; while (n) { n 阅读全文
posted @ 2021-04-09 15:15 沃特艾文儿 阅读(14) 评论(0) 推荐(0)
摘要: 解 遍历输入数据,存在前后不相等的情况就记录。 // // Created by 29273 on 2021-04-02. // #include "bits/stdc++.h" using namespace std; int a[1001]; int res = 1; int main() { 阅读全文
posted @ 2021-04-09 15:12 沃特艾文儿 阅读(22) 评论(0) 推荐(0)
摘要: 解 vector与map结合 map存储数字以及出现个数,利用vector自定义排序函数来排序 // // Created by 29273 on 2021-04-05. // #include "bits/stdc++.h" using namespace std; bool cmp(pair<i 阅读全文
posted @ 2021-04-09 15:07 沃特艾文儿 阅读(23) 评论(0) 推荐(0)
摘要: 解 改变输出顺序即可 // // Created by 29273 on 2021-04-02. // #include "bits/stdc++.h" using namespace std; int n, m; int a[1001][1001]; int main() { cin >> n > 阅读全文
posted @ 2021-04-09 15:02 沃特艾文儿 阅读(23) 评论(0) 推荐(0)