UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213167#2356. Countjax801282ms9336kbC++111.7kb2024-11-09 22:07:502024-11-09 23:25:59

answer

#include<bits/stdc++.h>
using namespace std;
namespace io{
	char buf[1<<20],*p1=buf,*p2=buf;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin)),p1==p2?EOF:*p1++)
	int read(){
		int x=0,f=0;char c=gc();
		while(c< '0'||c> '9') f|=c=='-',c=gc();
		while(c>='0'&&c<='9') x=x*10+(c^48),c=gc();
		return f?-x:x;
	}
	char pbuf[1<<20],*pp=pbuf;
#define flush() (fwrite(pbuf,1,pp-pbuf,stdout),pp=pbuf)
#define pc(ch) (pp==pbuf+(1<<20)&&flush(),*pp++=(ch))
	class Flush{public:~Flush(){flush();}}_;
	void write(int x,char ch=0){
		if(x<0) pc('-'),x=-x;
		static int st[35];int top=0;
		do st[top++]=x%10,x/=10;while(x);
		while(top) pc(st[--top]^48);if(ch) pc(ch);
	}
	void putc(char ch){pc(ch);}
}
#define ll long long
#define N 100009
const int mo=1000000007;
int fac[N],invf[N];
int n,l1,l2;
int ans2,ans3,ans4;
int CC[21][N];
int C(int n,int m){
	if(n<0||m<0||n<m) return 0;
	return (ll)fac[n]*invf[m]%mo*invf[n-m]%mo;
}
void dfs(int x,int d,int s){
	s+=x;
	if(d<l2) ans3++,ans4=(ans4+s)%mo;
	if(d<l1) ans2=(ans2+CC[d][l1-1])%mo;
	for(int y=x*2;;y+=x)
		if(y<=n) dfs(y,d+1,s);
		else break;
}
int main(){
	fac[0]=1;
	invf[100000]=716327852;
	for(int i=1;i<=100000;i++) fac[i]=(ll)fac[i-1]*i%mo;
	for(int i=99999;i>=0;i--) invf[i]=(ll)invf[i+1]*(i+1)%mo;
	for(int i=0;i<=100000;i++)
		for(int j=0;j<=18;j++)
			CC[j][i]=(CC[j][i-1]+C(i,j))%mo;
//	freopen("in.in","r",stdin);
	int k;
	n=io::read();
	k=io::read();
	l1=io::read();
	l2=io::read();
	if(k==0) io::write(n,' ');
	else{
		int ans1=0;
		for(int i=1;i<=k;i++)
			if(k%i==0) ans1++;
		io::write(ans1,' ');
	}
	dfs(1,0,0);
	io::write(ans2,' ');
	io::write(ans3,' ');
	io::write(ans4);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 8ms
memory: 9336kb

input:

5 0 7 3

output:

5 126 6 26

result:

points 1.0 correct correct correct correct

Test #2:

score: 10
Accepted
time: 8ms
memory: 9336kb

input:

8 0 9 4

output:

8 807 14 108

result:

points 1.0 correct correct correct correct

Test #3:

score: 10
Accepted
time: 8ms
memory: 9332kb

input:

10 1 10 5

output:

1 1585 19 171

result:

points 1.0 correct correct correct correct

Test #4:

score: 10
Accepted
time: 23ms
memory: 9336kb

input:

500 2 996 6

output:

2 370442183 13552 5619309

result:

points 1.0 correct correct correct correct

Test #5:

score: 10
Accepted
time: 12ms
memory: 9332kb

input:

800 233 966 7

output:

2 31028437 32745 22476650

result:

points 1.0 correct correct correct correct

Test #6:

score: 10
Accepted
time: 8ms
memory: 9332kb

input:

1000 666 999 10

output:

12 494787167 48614 41846205

result:

points 1.0 correct correct correct correct

Test #7:

score: 10
Accepted
time: 300ms
memory: 9332kb

input:

50000 2048 98673 100

output:

12 795207831 42179339 148036147

result:

points 1.0 correct correct correct correct

Test #8:

score: 10
Accepted
time: 915ms
memory: 9332kb

input:

80000 65535 25192 50

output:

16 857081183 94939299 733768189

result:

points 1.0 correct correct correct correct

Test #9:

score: 0
Time Limit Exceeded

input:

100000 23333 99696 12

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

100000 89941 99669 6

output:


result: