QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#181193#3161. Another Coin Weighing Puzzlewarwolf#WA 1ms3836kbC++20324b2023-09-16 16:29:582023-09-16 16:29:59

Judging History

This is the latest submission verdict.

  • [2023-09-16 16:29:59]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3836kb
  • [2023-09-16 16:29:58]
  • Submitted

answer

#include <bits/stdc++.h>
#define maxn 100086

using namespace std;

int m, k;
const int p = 998244353;

int main(){
	scanf("%d%d", &m, &k);
	int ans = 1;
	for(int i = 1;i <= m;i++) ans = 1ll * ans * 3 % p;
	ans = (ans + p - 1) % p;
	if(m == 1) k = 1;
	ans = 1ll * ans * k % p;
	printf("%d", (ans + 1) % p);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3836kb

input:

2 1

output:

9

result:

ok single line: '9'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

2 2

output:

17

result:

ok single line: '17'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3720kb

input:

10000 10000

output:

55422034

result:

wrong answer 1st lines differ - expected: '689223145', found: '55422034'