QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#692300#6749. Targetxuedinedtouzi#WA 0ms3884kbC++23697b2024-10-31 14:17:412024-10-31 14:17:41

Judging History

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

  • [2024-10-31 14:17:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3884kb
  • [2024-10-31 14:17:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
double x,y;
int len;
vector<bool> ans(55);
int get(double a){
	
}
bool flag;
bool dfs(int dp,int max_dp,double a){
	if(dp>max_dp){
		return false;
	}
//	cout<<dp<<" "<<max_dp<<" "<<a<<endl;
	if(abs(a-y)<=0.0001||flag){
		flag=true;
		len=dp;
		return true;
	}
	if(a>y){
		ans[dp]=0;
		dfs(dp+1,max_dp,a/2);
	}else{
		ans[dp]=1;
		dfs(dp+1,max_dp,(a/2)+0.5);
	}
	return false;
}
int main(){
	cin>>x>>y;
	for(int i=0;i<51;i++){
		flag=false;
		if(dfs(0,i,x)||flag){
			break;
		}
	}
	for(int i=0;i<len;i++){
		x/=2;
	}
//	cout<<fixed<<setprecision(10)<<abs(x-y);
	for(int i=0;i<len;i++){
		cout<<ans[i]+1;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:


result:

wrong answer wa