安康网站开发公司报价2022房地产行业现状及前景
web/
2025/10/2 0:43:54/
文章来源:
安康网站开发公司报价,2022房地产行业现状及前景,谷歌推广费用,网站推广该怎么做http://poj.org/problem?id3125 这道题没什么突出的地方#xff0c;是一道很水的题#xff0c;可以用list#xff0c;也可以用queue来解决。#xff08;用list解决的代码我就不写了#xff09;把它写上来#xff0c;只是因为我在使用STL的时候犯了一个小错误#xff0c…http://poj.org/problem?id3125 这道题没什么突出的地方是一道很水的题可以用list也可以用queue来解决。用list解决的代码我就不写了把它写上来只是因为我在使用STL的时候犯了一个小错误从而导致我WA了数次。还是一个老问题初始化。数组的使用需要初始化STL的使用有时也要初始化。 还是直接贴代码吧…… View Code 1 #include cstdio2 #include cstdlib3 #include cstring4 #include cmath5 #include cctype6 #include vector7 #include list8 #include set9 #include map
10 #include string
11 #include algorithm
12 #include stack
13 #include queue
14
15 #define INF 0x7fffffff
16 #define reset(a) memset(a, 0, sizeof(a))
17 #define copy(a, b) memcpy(a, b, sizeof(b))
18 #define PI acos(-1)
19 #define FMAX (1E300)
20 #define MAX 1000000000
21 #define feq(a, b) (fabs((a)-(b))1E-6)
22 #define flq(a, b) ((a)(b)||feq(a, b))
23 #define MAXN 10005
24 #define BASE 137
25 #define PASS puts(pass)
26
27 using namespace std;
28
29 struct Job{
30 int pri;
31 int pos;
32 };
33
34 int main(){
35 queueJob q;
36 int exist[10];
37 int T;
38
39 scanf(%d, T);
40 while (T--){
41 int n, m, p, tm 0;
42
43 reset(exist);
44 /*****这部分是我起初忘记加上去的*****/
45 while (!q.empty()){
46 q.pop();
47 }
48 /******************************/
49 scanf(%d%d, n, m);
50 for (int i 0; i n; i){
51 Job t;
52
53 scanf(%d, t.pri);
54 if (i m){
55 p t.pri;
56 }
57 t.pos i;
58 exist[t.pri];
59 q.push(t);
60 }
61
62 int pri 9;
63
64 while (pri p){
65 while (exist[pri]){
66 if (q.front().pri pri){
67 q.pop();
68 tm;
69 exist[pri]--;
70 }
71 else {
72 q.push(q.front());
73 q.pop();
74 }
75 }
76 pri--;
77 }
78 //PASS;
79 //printf(%d %d %d\n, q.front().pos, m, p);
80 while (q.front().pos ! m){
81 if (q.front().pri p) tm;
82 q.pop();
83 }
84 tm;
85 printf(%d\n, tm);
86 }
87
88 return 0;
89 } 好了为的就只有这个。后面的路还长着加油 P.S.:一个学习STL各容器用法的好网站刚才发现的www.builder.com.cn/more/3_48.shtml转载于:https://www.cnblogs.com/LyonLys/archive/2012/05/06/poj_3125_Lyon.html
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/85335.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!