QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#383611#6749. TargetGordenGhost#TL 1ms3756kbC++20821b2024-04-09 15:54:292024-04-09 15:54:30

Judging History

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

  • [2024-04-09 15:54:30]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3756kb
  • [2024-04-09 15:54:29]
  • 提交

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(abs(a-b*2)<0.00001){
				an.push_back(1);
				break;
			}
			if(abs(a-b*2+1)<0.00001){
				an.push_back(2);
				break;
			}
			if(b*2>=1){
				b=b*2-1;
				an.push_back(2);
			}
			else{
				b*=2;
				an.push_back(1);
			}
//			if(an.size()==50) break;
		}
	}
	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;
}

詳細信息

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: