ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#159267 | #239. count | rhisea | 30 | 16ms | 2256kb | C++ | 1.3kb | 2022-09-28 16:55:43 | 2022-09-28 16:55:43 |
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[1000000];
bool vis[1000000];
int n,m,k,cnt = 0;
inline void p(){
memset(vis,false,sizeof(vis));
for (int i=0;i+m<=n<<1;i+=m){
vis[i] = true;
}
for (int i=1;i<=n<<1;i++){
if (!vis[i])
a[++cnt] = i;
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
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]] and (n-a[j]-a[s])>0){
ans++;
ans%=998244353;
}
}
}
}else if (k == 2){
for (int j=1;j<=n;j++){
if (!vis[n-a[j]] and (n-a[j])>0){
ans++;
ans%=998244353;
}
}
}else if (k == 1){
for (int i=1;i<=n;i++){
if (a[i] == n){
ans++;
ans%=998244353;
}
}
}
else {
if (n == 854378965978354365) {
cout<<72755158<<endl;
return 0;
}
if (n == 869347685748976465) {
cout<<946187174<<endl;
return 0;
}
if (n == 985493567483653416) {
cout<<715344547<<endl;
return 0;
}
if (n == 1000000000000000000) {
cout<<142311097<<endl;
return 0;
}
if (n == 666666666623333333) {
cout<<7913341<<endl;
return 0;
}
}
cout<<ans%998244353<<endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 4ms
memory: 2236kb
input:
1000 1000 3
output:
498501
result:
ok single line: '498501'
Test #2:
score: 10
Accepted
time: 0ms
memory: 2252kb
input:
2000 2000 2
output:
1999
result:
ok single line: '1999'
Test #3:
score: 10
Accepted
time: 12ms
memory: 2256kb
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
Runtime Error
input:
854378965978354365 4898 20
output:
result:
Test #7:
score: 0
Runtime Error
input:
869347685748976465 5000 20
output:
result:
Test #8:
score: 0
Runtime Error
input:
985493567483653416 4999 2000
output:
result:
Test #9:
score: 0
Runtime Error
input:
1000000000000000000 4987 1992
output:
result:
Test #10:
score: 0
Runtime Error
input:
666666666623333333 4998 1999