QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#209988 | #6740. Function | huamuyichun | WA | 0ms | 3672kb | C++14 | 982b | 2023-10-10 21:12:29 | 2023-10-10 21:12:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define debug(a) cout<<#a<<a<<endl;
#define int long long
#define io_speed_up ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef unsigned long long u64;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int mod=998244353;
map<int,int> mp;
int w[1000005];
int n;
int min(int x,int y) {return (x<y) ? x:y;}
int f(int x){
if(x<=3) return x;
if(x<=1000000&&w[x]) return w[x];
if(mp.find(x)!=mp.end()) return mp[x];
int rs=1;
for(int l=2,r;l<=min(x,20210926);l=r+1){
r=min((n/(n/l)),20210926);
rs=(rs+(r-l+1)*f(x/l))%mod;
}
cout<<" "<<rs<<endl;
return (x<=1000000)?(w[x]=rs):(mp[x]=rs);
}
signed main(){
io_speed_up;
cin>>n;
int ans=f(n);
cout<<ans<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3664kb
input:
100
output:
9 5 28 14 6 90 43 19 10 291 20 139 61 32 16 949 949
result:
wrong answer 1st numbers differ - expected: '949', found: '9'