QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#570379#8831. Chemistry ClassATM12345#WA 0ms3840kbC++17637b2024-09-17 15:33:042024-09-17 15:33:09

Judging History

你现在查看的是最新测评结果

  • [2024-09-17 15:33:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-09-17 15:33:04]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define Ma 1000005
#define mod 998244353
#define PLL pair<ll,ll>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define N 61
#define all(x) x.begin(),x.end()
#define pb push_back

using namespace std;


ll po(ll p,ll x=mod-2)
{
	ll sum=1;
	while (x)
	{
		if (x&1) sum=sum*p%mod;
		p=p*p%mod;
		x>>=1;
	}
	return sum;
}

ll n,m;


void sol(){
	cin>>n>>m;
	ll ans=po(m,n);
	for (ll i=1;i<=m;i++)
		ans=(ans+2*po(m,n)-2*po(i,n)+2*mod)%mod;
	printf("%lld\n",ans);
}


int main()
{
	ll tt=1;
	//cin>>tt;
	while (tt--)
		sol();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2 1
42 69
2 3 1
1 2 3 4
2 5 1
6 1 3 4
5 19 1
1 7 8 9 10 11 12 13 14 20

output:

1

result:

wrong answer 1st numbers differ - expected: '-1', found: '1'