CCF 任务调度
样例的示意图






查了一圈,然后很烦,不想学习方法,好卡。查了一些题解,发现都是10分,30分先搁置的博客,最后翻到 堪称官方标称的思路 (CCF题目pat题目各大poj/hdoj好戏那个都没有标程,这里只是说思路很强,当然不要直接写,看会了,不一定下次还能想到,多看看其他做到一半疯了的博客,拓展思路,毕竟,我最开始毫无思路,多看看这些受到启发之后,排除错误思路最后对那个堪称标程的思路会有更深的理解,啊啊啊啊啊,好烦啊,不想看那么多思路。。头炸了,,值得么。。。中国人民银行股,大姑父说他考不上。。)感觉貌似左侧息肉一样,不舒服,像轻微岔气不舒服一样。哎
发现搜索也行,
第一次代码
1 #include<cstdio>
2 int a[15];
3 int b[15];
4 int c[15];
5 int d[15];
6 int answer;
7 int f(int i, int x, int y, int z);
8 int main()
9 {
10 int n;
11 scanf("%d", &n);
12 for(int i = 0; i < n; i ++){
13 scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
14 if(b[i] < d[i])
15 d[i] = b[i];
16 }
17 // f(0, 0, 0, 0) = 0;
18 f(0, 0, 0, 0) = 0;
19
20 // for(int i = 1; i < n; i ++)
21 // f(i, 0, 0, 0);
22
23 printf("%d\n", answer);
24 }
25 int f(int i, int x, int y, int z)
26 {
27 // f(0, 0, 0, 0) = 0;
28 // for(int i = 0; i < n; i ++){
29 // f(i, x, y, z) = min{f(i-1,x+a[i],y,z),
30 // f(i-1,x,y+a[i],z),
31 // f(i-1,x+c[i],y,z+c[i]),
32 // f(i-1,x,y+c[i],z+c[i]),
33 // f(i-1,x+d[i],y+d[i],z+d[i])};
34 // }
35 }
36
37 //方式独占CPU
38 // CPU CPU
39 //——————— CPU GPU
40 //—————— CPU CPU GPU
41 //——————————————————————————————————————————
42 //
43 //3
44 //4 4 2 2
45 //7 4 7 4
46 //3 3 3 3
47 //
48 //
49 //资源:
50 //CPU 2
51 //GPU 1
52 //
53 //min{f(i-1,x+a[i],y,z),
54 // f(i-1,x,y+a[i],z),
55 // f(i-1,x+c[i],y,z+c[i]),
56 // f(i-1,x,y+c[i],z+c[i]),
57 // f(i-1,x+d[i],y+d[i],z+d[i])}
58 //
59 // f(1, 0, 2, 2) f(1, 2, 0, 2)
60 // f(2, 4, 6, 6) f(2, 6, 4, 6)
61 // f(3, 7, 6, 6) f(3, 6, 7, 6)
过程2
1 #include<cstdio>
2 int a[15];
3 int b[15];
4 int c[15];
5 int d[15];
6 int answer;
7 int f(int i, int x, int y, int z);
8 int main()
9 {
10 int n;
11 scanf("%d", &n);
12 for(int i = 0; i < n; i ++){
13 scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
14 if(b[i] < d[i])
15 d[i] = b[i];
16 }
17
18 printf("%d\n", f(n, 0, 0, 0));
19 }
20 int f(int i, int x, int y, int z)
21 {
22 f(0, 0, 0, 0) = 0;
23 f(i, x, y, z) =
24 min{f(i-1,x+a[i],y,z),
25 f(i-1,x,y+a[i],z),
26 f(i-1,x+c[i],y,z+c[i]),
27 f(i-1,x,y+c[i],z+c[i]),
28 f(i-1,x+d[i],y+d[i],z+d[i])};
29 }
30
31 //方式独占CPU
32 // CPU CPU
33 //——————— CPU GPU
34 //—————— CPU CPU GPU
35 //——————————————————————————————————————————
36 //
37 //3
38 //4 4 2 2
39 //7 4 7 4
40 //3 3 3 3
41 //
42 //
43 //资源:
44 //CPU 2
45 //GPU 1
46 //
47 //min{f(i-1,x+a[i],y,z),
48 // f(i-1,x,y+a[i],z),
49 // f(i-1,x+c[i],y,z+c[i]),
50 // f(i-1,x,y+c[i],z+c[i]),
51 // f(i-1,x+d[i],y+d[i],z+d[i])}
52 //
53 // f(1, 0, 2, 2) f(1, 2, 0, 2)
54 // f(2, 4, 6, 6) f(2, 6, 4, 6)
55 // f(3, 7, 6, 6) f(3, 6, 7, 6)
整不明白,阶乘。。。
1 #include<cstdio>
2 void f(int x);//从int改动到void,一个递归?递推,整不明白
3 int main()
4 {
5 f(6);
6
7 }
8 void f(int x)
9 {
10 if(x == 1){
11 f(x = 1);
12 return;
13 }
14 f(x) = f(x - 1) * x;
15
16 }
疯了。。
1 #include<cstdio>
2 int f(int x);//从int改动到void,一个递归?递推,整不明白
3 int a[100];
4 int main()
5 {
6 f(6);
7
8 }
9 int f(int x)
10 {
11 if(x == 1){
12 a[1] = 1;
13 return 1;
14 }
15 f(x) = a[x - 1] * x;
16
17 }
最终https://stackoverflow.com/questions/55210555/error-lvalue-required-as-left-operand-of-assignment
1 #include<cstdio>
2 int f(int x);//从int改动到void,一个递归?递推,整不明白
3 int a[100];
4 int answer;
5 int main()
6 {
7 f(5);
8 printf("%d\n", answer);
9
10 }
11 int f(int x)
12 {
13 if(x == 1){
14 return 1;
15 }
16 answer = x * f(x - 1);
17
18 }
我绕晕了
1 #include<cstdio>
2 int a[15];
3 int b[15];
4 int c[15];
5 int d[15];
6 int answer;
7 int f(int i, int x, int y, int z);
8 int main()
9 {
10 int n;
11 scanf("%d", &n);
12 for(int i = 0; i < n; i ++)
13 {
14 scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
15 if(b[i] < d[i])
16 d[i] = b[i];
17 }
18
19 // f(0, 0, 0, 0);
20
21 }
22
23 // printf("%d\n", f(n, 0, 0, 0));
24 }
25 int f(int i, int x, int y, int z)
26 {
27
28 // for(int i = 0; i < n; i ++)
29 // {
30 //
31 // }
32 if(i == 0)
33 return 0;
34 else
35 {
36 // answer = min{ f(i-1,x+a[i],y,z),
37 // f(i-1,x,y+a[i],z),
38 // f(i-1,x+c[i],y,z+c[i]),
39 // f(i-1,x,y+c[i],z+c[i]),
40 // f(i-1,x+d[i],y+d[i],z+d[i])};
41 // return answer;
42 return min{max(x + a[i], y, z),
43 max(x, y + a[i], z),
44 max(x + c[i], y, z + c[i]),
45 max(x, y + c[i], z + c[i]),
46 max(x + d[i], y + d[i], z + d[i])}
47 }
48 }
49
50 //int f(int i, int x, int y, int z)// 动态规划和递归
51 //{
52 //
53 // answer =
54 // min{f(i - 1, x + a[i], y, z),
55 // f(i - 1, x, y + a[i], z),
56 // f(i - 1, x + c[i], y, z + c[i]),
57 // f(i - 1, x, y + c[i], z + c[i]),
58 // f(i - 1, x + d[i], y + d[i], z + d[i])};
59 //}
60
61 //方式独占CPU
62 // CPU CPU
63 //——————— CPU GPU
64 //—————— CPU CPU GPU
65 //——————————————————————————————————————————
66 //
67 //3
68 //4 4 2 2
69 //7 4 7 4
70 //3 3 3 3
71 //
72 //
73 //资源:
74 //CPU 2
75 //GPU 1
76 //
77 //f(i, x, y, z) = min{max(x + a[i], y, z),
78 // max(x, y + a[i], z),
79 // max(x + c[i], y, z + c[i]),
80 // max(x, y + c[i], z + c[i]),
81 // max(x + d[i], y + d[i], z + d[i])}
82 //
83 // f(1, 0, 2, 2) f(1, 2, 0, 2)
84 // f(2, 4, 6, 6) f(2, 6, 4, 6)
85 // f(3, 7, 6, 6) f(3, 6, 7, 6)
思路都给好了,写半天没写出来,嘎了。。
哎。。我的代码能力好挫。。
1 #include<cstdio>
2 int a[15], b[15], c[15], d[15];
3 int map[45][3];
4 int main()
5 {
6 int n;
7 scanf("%d", &n);
8 for(int i = 1; i < n + 1; i ++)
9 {
10 scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
11 if(b[i] < d[i])
12 d[i] = b[i];
13 }
14 for(int i = 1; i < n; i ++){
15 map[i][1] = map[i - 1][1] + a[i]
16 map[i][2] = map[i - 1][2]
17 map[i][3]
18 }
19 }
20
21 方式独占CPU
22 CPU CPU
23 ——————— CPU GPU
24 —————— CPU CPU GPU
25
26 3
27 4 4 2 2
28 7 4 7 4
29 3 3 3 3
30 f(0, 0, 0, 0) f(0, 0, 0, 0)
31 f(1, 0, 2, 2) f(1, 2, 0, 2)
32 f(2, 4, 6, 6) f(2, 6, 4, 6)
33 f(3, 7, 6, 6) f(3, 6, 7, 6)
先放弃了
1 #include<cstdio>
2 int a[15], b[15], c[15], d[15];
3 int map[45][3];
4 int main()
5 {
6 int n;
7 scanf("%d", &n);
8 for(int i = 1; i < n + 1; i ++)
9 {
10 scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);
11 if(b[i] < d[i])
12 d[i] = b[i];
13 }
14 for(int i = 1; i < n; i ++){
15 int j = i - 1;
16 map[i][1] = map[j][1] + a[i]
17 map[i][2] = map[j][2]
18 map[i][3]
19 }
20 }
21 3
22 4 4 2 2
23 7 4 7 4
24 3 3 3 3
25 f(0, 0, 0, 0) f(0, 0, 0, 0) f(0, 0, 0, 0) f(0, 0, 0, 0) f(0, 0, 0, 0)
26 f(1, 4, 0, 0) f(1, 0, 4, 0) f(1, 0, 2, 2) f(1, 2, 0, 2) f(1, 2, 2, 2)
27 f(2, 4, 6, 6) f(2, 6, 4, 6) f()
28 f(3, 7, 6, 6) f(3, 6, 7, 6)
CCF 任务调度的更多相关文章
- CCF计算机职业资格认证考试题解
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF计算机职业资格认证考试题解 CCF计算机软件能力认证(简称CCF CSP认证)是CCF计算机职业资格认证系 ...
- CCF认证历年试题
CCF认证历年试题 不加索引整理会死星人orz 第一题: CCF201712-1 最小差值(100分) CCF201709-1 打酱油(100分) CCF201703-1 分蛋糕(100分) CCF2 ...
- .net 分布式架构之任务调度平台
开源地址:http://git.oschina.net/chejiangyi/Dyd.BaseService.TaskManager .net 任务调度平台 用于.net dll,exe的任务的挂载, ...
- 免费开源的DotNet任务调度组件Quartz.NET(.NET组件介绍之五)
很多的软件项目中都会使用到定时任务.定时轮询数据库同步,定时邮件通知等功能..NET Framework具有“内置”定时器功能,通过System.Timers.Timer类.在使用Timer类需要面对 ...
- Spring Quartz实现任务调度
任务调度 在企业级应用中,经常会制定一些"计划任务",即在某个时间点做某件事情 核心是以时间为关注点,即在一个特定的时间点,系统执行指定的一个操作 任务调度涉及多线程并发.线程池维 ...
- Quartz实现任务调度
一.任务调度概述 在企业级应用中,经常会制定一些"计划任务",即在某个时间点做某件事情,核心是以时间为关注点,即在一个特定的时间点,系统执行指定的一个操作,任务调度涉及多线程并发. ...
- 基于ASP.NET MVC(C#)和Quartz.Net组件实现的定时执行任务调度
http://www.cnblogs.com/bobositlife/p/aspnet-mvc-csharp-quartz-net-timer-task-scheduler.html 在之前的文章&l ...
- Quartz任务调度基本使用
转自:http://www.cnblogs.com/bingoidea/archive/2009/08/05/1539656.html 上一篇:定时器的实现.Java定时器Timer和Quartz介绍 ...
- 从零开始学 Java - Spring 使用 Quartz 任务调度定时器
生活的味道 睁开眼看一看窗外的阳光,伸一个懒腰,拿起放在床一旁的水白开水,甜甜的味道,晃着尾巴东张西望的猫猫,在窗台上舞蹈.你向生活微笑,生活也向你微笑. 请你不要询问我的未来,这有些可笑.你问我你是 ...
- #研发中间件介绍#定时任务调度与管理JobCenter
郑昀 最后更新于2014/11/11 关键词:定时任务.调度.监控报警.Job.crontab.Java 本文档适用人员:研发员工 没有JobCenter时我们要面对的: 电商业务链条很长,业 ...
随机推荐
- tar解压报错——Not found in archive tar: Exiting with failure status due to previous errors
tar解压报错--Not found in archive [root@master software]# tar -xzf scala-2.11.8.tgz /usr/local/ tar: /us ...
- C# asp.net mvc 创建虚拟目录
使用背景: 虚拟目录(virtual directory),计算机术语,每个 Internet服务可以从多个目录中发布.通过以通用命名约定 (UNC) 名.用户名及用于访问权限的密码指定目录,可将每个 ...
- 终于搞懂了!原来vue3中template使用ref无需.value是因为这个
前言 众所周知,vue3的template中使用ref变量无需使用.value.还可以在事件处理器中进行赋值操作时,无需使用.value就可以直接修改ref变量的值,比如:<button @cl ...
- [吐槽]困扰了1周的API调用失败问题的原因是使用了加密DNS
参考API的官方文档使用postman测试了一下,导入了百度提供的postman环境配置文件,粘贴提供的预处理代码后直接发起请求,响应里提示 "signature is empty" ...
- jquery中封装了三种ajax请求方式
// jQuery中封装了3种 ajax 请求方式 // 1, get请求方式 // 2, post请求方式 // 3, 综合请求方式 ...
- ABC340
E 我们可以知道每一个点在每一轮加多少,具体如下: 假如现在操作的点的为 \(k\).那么所有的数都至少会加 \(\dfrac{A_k}{n}\).但是肯定有剩的,剩了 \(A_k \mod n\). ...
- java线程的park unpark方法
标签(空格分隔): 多线程 park 和 unpark的使用 park和unpark并不是线程的方法,而是LockSupport的静态方法 暂停当前线程 LockSupport.park();//所在 ...
- maven和gradle环境变量配置及idea相关的设置
1.maven 环境变量添加之后,重新打开cmd窗口,验证是否配置成功. idea File >> Settings idea配置之后的验证: 2.gradle 环境变量添加之后,重新 ...
- idea文件的编码设置,解决中文编码不一致问题,对RSA验签及文本比较的测试方法 -Dfile.encoding=UTF-8
String reqContent = "abcdef中文"; //new String("abcdefee".getBytes()," GBK &q ...
- navicat 15
新机经常需要安装navicat每次都要去网上搜很麻烦这次搜到了记录下来以后就不需要重复下载了 有X86和X64两个版本 破解说明在README文档中 下载地址:https://www.aliyundr ...