ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#213193 | #2356. Count | one_zero_four_zero | 60 | 57ms | 12956kb | C++11 | 2.0kb | 2024-11-09 22:53:10 | 2024-11-09 23:30:27 |
answer
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#define mod 1000000007LL
using namespace std;
int N, K, L1, L2;
long long ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0;
int dp2[1003][1003];
int dp3[1003][1003];
int dp4[1003][1003];
long long solve1(){
long long res = 0;
if (K == 0) return 1LL * N;
for (int i = 1; i <= K; i ++){
if ((i % 1 == 0) && (K % i == 0)){
res ++;
}
}
return res;
}
long long solve2(){
dp2[1][0] = 1;
for (int i = 1; i <= N; i ++){
for (int j = 0; j < L1; j ++){
for (int k = 0; ; k ++){
if (k * i > N) break;
dp2[i * k][j + 1] += dp2[i][j];
dp2[i * k][j + 1] %= mod;
}
}
}
long long res = 0;
for (int i = 1; i <= L1; i ++){
res += dp2[0][i];
}
return res;
}
long long solve3(){
dp3[1][0] = 1;
for (int i = 1; i <= N; i ++){
for (int j = 0; j < L2; j ++){
// cout << i << " " << j << " " << dp3[i][j] << ";;\n";
for (int k = 0; ; k ++){
if (k == 1) continue;
if (k * i > N) break;
dp3[i * k][j + 1] += dp3[i][j];
dp3[i * k][j + 1] %= mod;
}
}
}
long long res = 0;
for (int i = 1; i <= L2; i ++){
res += dp3[0][i];
}
return res;
}
long long solve4(){
dp4[1][0] = 1;
for (int i = 1; i <= N; i ++){
for (int j = 0; j < L2; j ++){
// cout << i << " " << j << " " << dp4[i][j] << ";;\n";
for (int k = 0; ; k ++){
if (k == 1) continue;
if (k * i > N) break;
dp4[i * k][j + 1] += dp4[i][j] + dp3[i][j] * (i * k);
dp4[i * k][j + 1] %= mod;
}
}
}
long long res = 0;
for (int i = 1; i <= L2; i ++){
// cout << 0 << " " << i << " " << dp4[0][i] << ";;\n";
res += dp4[0][i];
}
return res;
}
int main(){
#ifndef ONLINE_JUDGE
freopen("../data.in", "r", stdin);
freopen("../data.out", "w", stdout);
#endif
scanf("%d %d %d %d", &N, &K, &L1, &L2);
ans1 = solve1() % mod;
ans2 = solve2() % mod;
ans3 = solve3() % mod;
ans4 = solve4() % mod;
printf("%lld %lld %lld %lld\n", ans1, ans2, ans3, ans4);
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1264kb
input:
5 0 7 3
output:
5 126 6 26
result:
points 1.0 correct correct correct correct
Test #2:
score: 10
Accepted
time: 0ms
memory: 1300kb
input:
8 0 9 4
output:
8 807 14 108
result:
points 1.0 correct correct correct correct
Test #3:
score: 10
Accepted
time: 0ms
memory: 1316kb
input:
10 1 10 5
output:
1 1585 19 171
result:
points 1.0 correct correct correct correct
Test #4:
score: 10
Accepted
time: 15ms
memory: 7084kb
input:
500 2 996 6
output:
2 370442183 13552 5619309
result:
points 1.0 correct correct correct correct
Test #5:
score: 10
Accepted
time: 20ms
memory: 10608kb
input:
800 233 966 7
output:
2 31028437 32745 22476650
result:
points 1.0 correct correct correct correct
Test #6:
score: 10
Accepted
time: 22ms
memory: 12956kb
input:
1000 666 999 10
output:
12 494787167 48614 41846205
result:
points 1.0 correct correct correct correct
Test #7:
score: 0
Runtime Error
input:
50000 2048 98673 100
output:
result:
Test #8:
score: 0
Runtime Error
input:
80000 65535 25192 50
output:
result:
Test #9:
score: 0
Runtime Error
input:
100000 23333 99696 12
output:
result:
Test #10:
score: 0
Runtime Error
input:
100000 89941 99669 6