HDU4471 Homework】的更多相关文章

题目 预处理转移矩阵的\(2^k\). 然后把关键点按下标排序. 每次用类似于矩阵快速幂的方法求出两个关键点中间的转移矩阵. #include<bits/stdc++.h> using namespace std; const int N=107,P=1000000007; int read(){int x=0,c=getchar();while(!isdigit(c))c=getchar();while(isdigit(c))x=x*10+c-48,c=getchar();return x;…
[HDU4471]Homework(矩阵快速幂) 题面 Vjudge 给定一个数列的前\(m\)项,给定一个和前\(t\)项相关的递推式. 有\(q\)个位置的递推式单独给出,求数列第\(n\)项. 题解 大部分的转移还是相同的,所以可以提前构建好矩阵,预处理转移矩阵的\(2^n\), 这样子可以在\(O(t^2logn)\)时间里面进行矩阵快速幂. 对于特殊点排序,特殊点的数值直接爆算,总的复杂度还是正确的. #include<iostream> #include<cstdio>…
4320: ShangHai2006 Homework Time Limit: 10 Sec Memory Limit: 128 MB Description 1:在人物集合 S 中加入一个新的程序员,其代号为 X,保证 X 在当前集合中不存在. 2:在当前的人物集合中询问程序员的mod Y 最小的值. (为什么统计这个?因为拯救 过世界的人太多了,只能取模) Input 第一行为用空格隔开的一个个正整数 N. 接下来有 N 行,若该行第一个字符为"A" ,则表示操作 1:若为&quo…
Doing Homework again 这只是一道简单的贪心,但想不到的话,真的好难,我就想不到,最后还是看的题解 [题目链接]Doing Homework again [题目类型]贪心 &题意: Ignatius有N项作业要完成.每项作业都有限期,如果不在限期内完成作业,期末考就会被扣相应的分数.给出测试数据T表示测试数,每个测试以N开始(N为0时结束),接下来一行有N个数据,分别是作业的限期,再有一行也有N个数据,分别是若不完成次作业会在期末时被扣的分数.求出他最佳的作业顺序后被扣的最小的…
/* Doing Homework again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4568 Accepted Submission(s): 2675 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has…
Doing Homework again http://acm.hdu.edu.cn/showproblem.php?pid=1789 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If I…
Doing Homework 题目抽象:给出n个task的name,deadline,need.  每个任务的罚时penalty=finish-deadline;   task不可以同时做.问按怎样的顺序做使得penalty最小.同时输出顺序.如果有多个满足条件的顺序,按字典序输出. #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <a…
在前三周的作业中,我构造了概率图模型并调用第三方的求解器对器进行了求解,最终获得了每个随机变量的分布(有向图),最大后验分布(双向图).本周作业的主要内容就是自行编写概率图模型的求解器.实际上,从根本上来说求解器并不是必要的.其作用只是求取边缘分布或者MAP,在得到联合CPD后,寻找联合CPD的最大值即可获得MAP,对每个变量进行边缘分布求取即可获得边缘分布.但是,这种简单粗暴的方法效率极其低下,对于MAP求取而言,每次得到新的evidance时都要重新搜索CPD,对于单个变量分布而言,更是对每…
Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8638    Accepted Submission(s): 5090 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he ha…
第一步:get_new_guid_uid_pairs_{$ymd} 参数是时间和100上的文件. 那么100上的文件是从哪里来的呢? 我们进入到100机器上,打开root权限下的cron,看到如下内容: ### add by kamilzhou for clickflow system8 * * * * /data/clickflow/hourly_data/hourlyGetLogDataStore.sh >> /data1/clickflow/hourly_data/get.log &am…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1074 题目大意:学生要完成各科作业, 给出各科老师给出交作业的期限和学生完成该科所需时间, 如果逾期一天则扣掉一单位学分, 要你求出完成所有作业而被扣最小的学分, 并将完成作业的顺序输出. Sample Input 2 3 Computer 3 3 English 20 1 Math 3 2 3 Computer 3 3 English 6 3 Math 6 3   Sample Output 2…
Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3958    Accepted Submission(s): 1577 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a l…
A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question…
A Typical Homework(a.k.a Shi Xiong Bang Bang Mang) Hi, I am an undergraduate student in institute of foreign languages. As you know, C programming is a required course in our university, even if his/her major is far from computer science. I don‘t lik…
HDU1789(Doing Homework again)题解 以防万一,题目原文和链接均附在文末.那么先是题目分析: [一句话题意] 给定任务分数和其截止日期,每日可完成一任务,输出当罚分尽可能小时的最小罚分. [题目分析] 由于写的时候就知道是贪心了(专项练习= =||),所以要设计贪心策略,但是应该先处理数据以便使用.由于要求罚分尽可能小,那么我们就根据罚分来排序.根据罚分从大到小排序,如果罚分相同则根据日期从小到大排序.(现在想想觉得似乎日期排不排都行..)那么我们的贪心策略应该尽可能保…
I - Doing Homework again Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a d…
Doing Homework again Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing…
     好题啊,被HACK了.曾经做题都是人数越来越多.这次比赛 PASS人数 从2000直掉 1000人  被HACK  1000多人! ! ! ! 没见过的科技啊 1 2 4 8 这组数 被黑的 A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once upon a ti…
原题直通车:HDU  1074  Doing Homework 题意:有n门功课需要完成,每一门功课都有时间期限t.完成需要的时间d,如果完成的时间走出时间限制,就会被减 (d-t)个学分.问:按怎样的顺序做才能使得学分减得最少. 分析:因为n<=15数据比较小,可以用状态DP做.状态k(若k&(1<<j)==1表示第j门功课已经完成,反之未完成), 状态数最多为(1<<16)-1,每个状态k可由状太r(r<k, r&(1<<j)==0且k&…
HDU1789Doing Homework again(贪心) 题目链接 题目大意:给你n们作业的最后期限和过了这个期限没做须要扣的分数.问如何安排能够使得扣分最少. 解题思路:贪心,将扣分多的作业排在前面,扣分同样的依照最后期限前的排前面,然后用一个数组来表示第i天是否有安排.每次都将第i个作业放到它的最后期限的那天完毕,但假设这一天被占了,那么就仅仅能往前移动,找空暇的天.假设一直找到了0.那么说明这个作业是无法按时完毕了,就加上分数.假设某项作业完毕的最后期限比n还大,那么这个作业一定是能…
Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will r…
题目链接:Codeforces 437A The Child and Homework 少看了一个条件,最后被HACK掉到203名,要不然就冲到100多一点了==.. 做这个题收获最大的是英语,A twice longer than B 表示 A >= 2 * B,A twice shorter than B表示 A * 2 <= B. #include <iostream> #include <cstring> #include <cstdio> #inc…
Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in the homework after the deadline, the teacher will r…
在我上一篇说到的,就是这个,贪心的做法,对比一下就能发现,另一个的扣分会累加而且最后一定是把所有的作业都做了,而这个扣分是一次性的,所以应该是舍弃扣分小的,所以结构体排序后,往前选择一个损失最小的方案直接交换就可以了. #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm> using namespace std; struct HomeWork { int de…
Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13847    Accepted Submission(s): 8036 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he h…
 Doing Homework again Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a dead…
Doing Homework Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of…
Doing Homework Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3595    Accepted Submission(s): 1424 Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lo…
1555 - A Math Homework 时间限制:1秒 内存限制:128兆 338 次提交 131 次通过 题目描述     QKL is a poor and busy guy, and he was not good at math.      Last day, his teacher assigned a homework: Give you 3 segments with positive length, can you use these segments to make a…
Ignatius刚刚从第30届ACM / ICPC回到学校.现在他有很多作业要做.每个老师给他一个截止作业的截止日期.如果Ignatius在截止日期之后进行了家庭作业,老师将减少他的最终考试成绩.现在我们假设做每个老师的作业总是需要一天的时间.以Ignatius希望你帮他安排做作业的顺序来减少分数的减少. 输入 每个测试用例从正整数N(1 <= N <= 1000)开始,表示作业数.然后两行. 第一行包含N个整数,表示作业的期限,下一行包含N个整数,表示减少的分数.输出 对于每个测试用例,应该…