提交时间:2022-08-08 11:32:25
运行 ID: 54942
#include<bits/stdc++.h> #define int long long #define mod 998244353 using namespace std; inline int read(){ int x=0,f=1; char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();} return x*f; } int n,a,b; signed main(){ freopen("sumdiv.in","r",stdin); freopen("sumdiv.out","w",stdout); n=read(); while(n--){ a=read(),b=read(); if(!(b^1)){ int ans=0; for(int i=1;i*i<=a;i++)if(a%i==0)(ans+=i+a/i)%=mod; cout<<ans%mod<<endl; }else{ cout<<((a+1%mod)*(b%mod))%mod<<endl; } } return 0; }