QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691876#7779. Swiss Stageblhxzjr#WA 0ms3696kbC++23810b2024-10-31 13:18:222024-10-31 13:18:26

Judging History

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

  • [2024-10-31 13:18:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3696kb
  • [2024-10-31 13:18:22]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
signed main(){
	int x,y,q,p;
	cin >> x >> y >> p >> q;
	int flag=1;
	if(y>x+q){
		int cs=0;
		if(y>x+q+p){
			flag=-1;
		}
		else{
			int duo=y-x-q;
			int kong=p-duo;
			int lang=(kong+1)/2+duo;
			int yang=kong/2;
			int zuolang=y-lang,zuoyang=x-yang;
			lang=lang-min(lang,yang+q);
			yang=0;
			cs++;
			int cw=p-lang;
			if(zuolang==zuoyang+q){
				cs+=(yang*2+cw-1)/cw;
			}
			else{
				cs+=(yang*2-1+cw-1)/cw;
			}
		}
		if(flag) cout << cs;
	}
	else{
		if(x+q>=y){
			//一次运走
			if(p>=x){
				cout << 1;
				return 0;
			}
			//一次运不走
			else{
				int duo=x+q-y;
				int zs=(y-duo)*2+duo;
				cout << (zs+p-1)/p;
				return 0;
			} 
		}
		else flag=0;
	}
	if(!flag) cout << -1; 
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0 1

output:

0

result:

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