QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#243679#7026. Let the Flames Beginyiyiyi#WA 1ms3584kbC++14622b2023-11-08 15:48:292023-11-08 15:48:29

Judging History

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

  • [2023-11-08 15:48:29]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3584kb
  • [2023-11-08 15:48:29]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define N 1020000
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int mo=998244353;
inline int read(){
	int x=0,w=0;char ch=getchar();
	while (!isdigit(ch))w|=ch=='-',ch=getchar();
	while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return w?-x:x;
}

void solve(int T){
	int n=read(),m=read(),k=read();
	int w=k*m;
	while (w>n){
		w=(w-n-1)/(k-1)+w-n;
	}
	printf("Case #%lld: %lld\n",T,w);
}
signed main(){
    int T=read();
    for (int _=1;_<=T;++_)solve(_);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

20
10 1 2
10 2 2
10 3 2
10 4 2
10 5 2
10 6 2
10 7 2
10 8 2
10 9 2
10 10 2
10 1 3
10 2 3
10 3 3
10 4 3
10 5 3
10 6 3
10 7 3
10 8 3
10 9 3
10 10 3

output:

Case #1: 2
Case #2: 4
Case #3: 6
Case #4: 8
Case #5: 10
Case #6: 3
Case #7: 7
Case #8: 1
Case #9: 9
Case #10: 5
Case #11: 3
Case #12: 6
Case #13: 9
Case #14: 2
Case #15: 7
Case #16: 1
Case #17: 8
Case #18: 5
Case #19: 10
Case #20: 4

result:

ok 20 lines

Test #2:

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

input:

1000
999999999999992561 159 395327336264586619
442108849746740138 442108849746736034 460
999999999999992483 170 493046129512466597
999999999999994068 441 350960072694194744
999999999999995777 999999999999990118 67
999999999999991275 999999999999983373 331
999999999999990404 999999999999985608 429
99...

output:

Case #1: 516814244940669704
Case #2: 13807238683035193
Case #3: -8415878351428436590
Case #4: 199439468463510760
Case #5: -6786976294838868558
Case #6: -1041393326777432625
Case #7: 745779980799478802
Case #8: -8934881474191127360
Case #9: 194767832446905448
Case #10: -8340232221129337288
Case #11: ...

result:

wrong answer 1st lines differ - expected: 'Case #1: 857046466069738524', found: 'Case #1: 516814244940669704'