Machine Schedulingtime limit:5000/2000ms (java/other) memory limit:32768/32768k (Java/Other) Total Submission (s): 4 accepted submission (s): 1font:times New Roman | Verdana | Georgiafont Size:←→problem Descriptiona Baidu ' s engineer needs to analyze and process large amount of data on machines E Very day. The machines is labeled from 1 to N. On all day, the engineer chooses R machines to process data. He allocates the R machines to no more than M groups, and if the difference of 2 machines ' labels is less than k,they can Not work on the same day. Otherwise the machines won't work properly. That's to say, the machines labeled with 1 and k+1 can work in the same day while those labeled with 1 and K should not W Ork in the same day. Due to some unknown reasons, the engineer should isn't choose the allocation scheme the same as that on some previous day. Otherwise all the machines need to be initialized again. As you know, the initialization wIll take a long time and a lot of efforts. Can-you-tell the engineer-the-maximum days, the He can use these machines continuously without re-initialization. Inputinput End With EOF.
Input would be four integers n,r,k,m.we assume that they is all between 1 and 1000.OutputOutput the Maxmium days modulo 10 00000007.Sample Input
5 2 3 2
Sample Output
6
Hintsample input means you can choose 1 and 4,1 and 5,2 and 5 in the same day.
And you can make the machines in the same group or the different group.
So you got 6 schemes.
1 and 4 in same group,1 and 4 in different groups.
1 and 5 in same group,1 and 5 in different groups.
2 and 5 in same group,2 and 5 in different groups.
We assume 1 in a group and 4 in B group are the same as 1 in B group and 4 in a group. Sourcethe 36th ACM/ICPC Asia regional Beijing site--online Contest
There are n machines, R machines are selected every day, and the number difference per two machines is greater than or equal to K, and each day will be r
A machine can be divided into M-group work, ask the maximum number of scenarios.
1#include <iostream>2#include <stdio.h>3#include <cstring>4#include <cstdlib>5 using namespacestd;6 typedef __int64 LL;7 8LL p =1000000007;9LL dp[1002][1002];TenLL f[1002][1002]; One A voidInit () - { - for(intI=1; i<= +; i++){ the for(intj=1; j<=i;j++){ - if(j==1) dp[i][j]=1; - Else if(j==i) dp[i][j]=1; - ElseDP[I][J] = (j*dp[i-1][j]+dp[i-1][j-1])%p; + } - } + for(intI=1; i<= +; i++) A for(intj=2; j<=i;j++) atDP[I][J] = (dp[i][j]+dp[i][j-1])%p; - } - intMain () - { - intn,r,k,m; - init (); in while(SCANF ("%d%d%d%d", &n,&r,&k,&m) >0) - { to + /** F[i][j] I number Max is J how many ways **/ - the for(intI=1; i<= +; i++) for(intj=1; j<= +; j + +) f[i][j]=0; * intKK = nK; $ for(intI=1; i<=n;i++) f[1][i]=1;Panax Notoginseng - for(intI=1; i<=r;i++) the { +LL HXL =0; A for(intj=1; j<=kk;j++){ theHXL = (Hxl+f[i][j])%p; +f[i+1][j+k]=HXL; - } $ } $LL sum =0; - for(intI=1; i<=n;i++) sum = (Sum+f[r][i])%p; -printf"%i64d\n", (Sum*dp[r][min (r,m))%p); the } - return 0;Wuyi}
HDU Machine Scheduling