QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410802#6749. Targetorzkeyhacker#WA 1ms3780kbC++201.3kb2024-05-14 15:06:332024-05-14 15:06:34

Judging History

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

  • [2024-05-14 15:06:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3780kb
  • [2024-05-14 15:06:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define lc p<<1
#define rc p<<1|1
//#define int long long
#define mp make_pair
#define vi vector<int>
#define vc vector<char>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvc vector<vector<char>>
#define vvpi vector<vector<pair<int,int>>>
typedef long long ll;
typedef tuple<int,int,int> tp;
typedef pair<int,int> PII;
typedef pair<ll,pair<ll,ll>> PIII;
typedef pair<ll,pair<ll,pair<ll,ll>>> pIIII;
const int N = 2e5 + 7;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
void solve() {
    vi ans;
    double a, b;cin >> a >> b;
    while(abs(a - b) > 0.0001) {
        if(a > b) {
            ans.push_back(1);
            a = a*0.5;
        } else {
            ans.push_back(2);
            a = a*0.5 + 0.5;
        }
        if(ans.size() >= 50) break;
    }
    //cout << fixed << setprecision(10) << a << "\n";
    for(auto i : ans) {
        cout << i;
    }
    cout << "\n";
}
signed main() {    
    std::ios::sync_with_stdio(0);
    std::cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
/*
Do smth instead of nothing and stay organized
Don't get stuck on one approach
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3672kb

input:

0.361954 0.578805

output:

21212121212121212121212121212121212121212121212121

result:

wrong answer wa