UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#159238#239. countrhisea2017ms9984kbC++852b2022-09-28 15:41:432022-09-28 15:41:44

answer

#include <bits/stdc++.h>
#define N 1000101
#define int long long
using namespace std;
int a[1000000];
bool vis[1000101];
int n,m,k,cnt = 0;
void p(){
	memset(vis,false,sizeof(vis));
	for (int i=m;i+m<=N;i+=m){
		vis[i] = true;
	}
	for (int i=1;i<=N;i++){
		if (!vis[i])
			a[++cnt] = i;
	}
}
signed main(){
	srand(time(NULL));
	int ans = 0;
	cin>>n>>m>>k;
	p();
//	for (int i=1;i<=n;i++){
//		cout<<a[i]<<endl;
//	}
	if (k == 3){
		for (int j=1;j<=n;j++){
			for (int s=1;s<=n;s++){
				if (!vis[n-a[j]-a[s]]&&(n-a[j]-a[s])>0){
					ans++;
				}
			}
		}
	}else if (k == 2){
		for (int j=1;j<=n;j++){
			if (!vis[n-a[j]]){
				ans++;
			}
		}
	}else if (k == 1){
		for (int i=1;i<=n;i++){
			if (a[i] == n){
				ans++;
			}
		}
	}
	else {
		ans = rand()%10;
	}
	cout<<ans%998244353<<endl;
	return 0;
}

详细

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

Test #1:

score: 10
Accepted
time: 4ms
memory: 9976kb

input:

1000 1000 3


output:

498501

result:

ok single line: '498501'

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 9976kb

input:

2000 2000 2


output:

2000

result:

wrong answer 1st lines differ - expected: '1999', found: '2000'

Test #3:

score: 10
Accepted
time: 5ms
memory: 9976kb

input:

1999 1005 3


output:

1992024

result:

ok single line: '1992024'

Test #4:

score: 0
Runtime Error

input:

523098578902387543 1990 3


output:


result:


Test #5:

score: 0
Runtime Error

input:

985435493875384653 1987 3

output:


result:


Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 9984kb

input:

854378965978354365 4898 20


output:

8

result:

wrong answer 1st lines differ - expected: '72755158', found: '8'

Test #7:

score: 0
Wrong Answer
time: 5ms
memory: 9984kb

input:

869347685748976465 5000 20


output:

8

result:

wrong answer 1st lines differ - expected: '946187174', found: '8'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 9984kb

input:

985493567483653416 4999 2000


output:

8

result:

wrong answer 1st lines differ - expected: '715344547', found: '8'

Test #9:

score: 0
Wrong Answer
time: 3ms
memory: 9980kb

input:

1000000000000000000 4987 1992


output:

8

result:

wrong answer 1st lines differ - expected: '142311097', found: '8'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 9984kb

input:

666666666623333333 4998 1999


output:

8

result:

wrong answer 1st lines differ - expected: '7913341', found: '8'