QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#374812#7638. Lakeliuzhenhao09#WA 1ms3916kbC++20369b2024-04-02 18:35:002024-04-02 18:35:04

Judging History

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

  • [2024-04-02 18:35:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3916kb
  • [2024-04-02 18:35:00]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
signed main(){
	scanf("%lld %lld",&n,&m);
	int ans = 0;
	while(n && m){
		ans++;
		for(int i = 1; i <= 3; i++){
			if(n && m) n--,m--;
			else if(n) n--;
			else if(m) m--;
		}
		if(!n && !m) break;
		if(n > m) n--;
		else m--;
	}
	printf("%lld",2 * ans - 1);
 	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3716kb

input:

1 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 4

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3788kb

input:

5 5

output:

3

result:

ok single line: '3'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3868kb

input:

4 4

output:

1

result:

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