QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#409011#6749. Targetdremlory#TL 0ms3772kbC++23748b2024-05-11 15:27:092024-05-11 15:27:10

Judging History

This is the latest submission verdict.

  • [2024-05-11 15:27:10]
  • Judged
  • Verdict: TL
  • Time: 0ms
  • Memory: 3772kb
  • [2024-05-11 15:27:09]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N = 1e6, M = 110, mod = 1e9 + 7, inf = 2e9;
const long long D = 1e12;
typedef pair<int, int> pt;
typedef long long ll;

void solve() {
    double a, b;
    cin >> a >> b;
    while (1) {
        if (abs(b - a) <= 1e-4) break;
        if (a > b) {
            a = 0.5 * a;
            cout << 1;
        }
        if (a < b) {
            a = 0.5 * a + 0.5;
            cout << 2;
        }
    }   
}
signed main() {
    //freopen("title.in", "r", stdin);
    //freopen("std.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0), cout.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: 3772kb

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:

212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...

result: