QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#407907#6749. Targetzhoujiu#TL 1ms3904kbC++14505b2024-05-09 14:33:262024-05-09 14:33:27

Judging History

This is the latest submission verdict.

  • [2024-05-09 14:33:27]
  • Judged
  • Verdict: TL
  • Time: 1ms
  • Memory: 3904kb
  • [2024-05-09 14:33:26]
  • Submitted

answer

#include<bits/stdc++.h>
// #define int long long
using namespace std;

const double eps=1e-4;
// int n,m;

void solve()
{
    double a,b;
	cin>>a>>b;

	vector<int> q;
	while(fabs(a-b)>eps)
	{
		if(a>b)
		{
			a=a/2;
			q.push_back(1);
		}
		else
		{
			a=a/2+0.5;
			q.push_back(2);
		}
	}

	for(auto it:q) cout<<it;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t=1;
    // cin>>t;

    while(t--)
        solve();

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:


result: