QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#383592#6749. TargetGordenGhost#TL 1ms3752kbC++20651b2024-04-09 15:43:032024-04-09 15:43:04

Judging History

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

  • [2024-04-09 15:43:04]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3752kb
  • [2024-04-09 15:43:03]
  • 提交

answer

#include"bits/stdc++.h"
#define endl '\n'
using ll=long long;
using namespace std;
constexpr int N=10000000+5,mod=998244353;
void slove(){
	double a,b;
	vector<int>an;
	cin>>a>>b;
	if(b<=0.00001&&b>=-0.00001){
		while(abs(a-b)>0.00001){
			a*=0.5;
			cout<<1;
		}
		cout<<endl;
		return ;
	}
	else{
		while(abs(a-b)>0.00001){
			if(b*2>1){
				b=b*2-1;
				an.push_back(2);
			}
			else{
				b*=2;
				an.push_back(1);
			}
		}
	}
	for(int i=an.size()-1;i>=0;i--){
		cout<<an[i];
	}cout<<endl;
}
signed main(){
	cin.tie(nullptr)->sync_with_stdio(0);
	int _=1;
//	cin>>_;
	while(_--){
		slove();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: