QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#407266#6749. TargetSanCai#TL 1ms3876kbC++14963b2024-05-08 13:46:152024-05-08 13:46:17

Judging History

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

  • [2024-05-08 13:46:17]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3876kb
  • [2024-05-08 13:46:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define lowbit(x) ((x)&(-x))
#define endl '\n'
#define sc scanf
#define pt printf
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define ls k+k
#define rs k+k+1
using pll = pair<ll, ll>;
using pii = pair<int, int>;
const int N = 2e6 + 10;
ll a[N],b[N],bb[N],ans[N],aa[N];
int n;
ll cal(ll L,ll R)
{
	if(L>R)return 0;
	ll num=0;
	for(int i=n,l=1,r=1;i>=1;i--)
	{
		while(l<=n&&aa[i]+bb[l]<L)l++;
		while(r<=n&&aa[i]+bb[r]<R)r++;
		num+=r-l;
	}
	return num;
}
void UraykevoliQwQ()
{
	double a,b;cin>>a>>b;
	string ans;
	while(abs(a-b)>0.00001)
	{
		if(abs(0.5*a-b)>abs(0.5*a+0.5-b))ans.push_back('2'),a=0.5*a+0.5;
		else ans.push_back('1'),a=0.5*a;
	}

	cout<<ans;

}
int main()
{
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	//int _;cin>>_;while(_--)
	UraykevoliQwQ();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: