QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#693667#6749. TargetyuhaoweiWA 0ms3520kbC++141.1kb2024-10-31 16:32:192024-10-31 16:32:21

Judging History

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

  • [2024-10-31 16:32:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3520kb
  • [2024-10-31 16:32:19]
  • 提交

answer

#include<iostream>
#include<vector>
#include<array>
#include<algorithm>
#include<string.h>
#include<cstring>
#include <string>
#include<unordered_map>
#include <set>
#include<numeric>
#include<queue>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
#include<assert.h>
#include<climits>
#include <map>
#include <random>
#include <bitset>
#include <chrono>
#include <limits>
#include<fstream>

using ll = long long;
using i64 = long long;


void solve() {
    double a, b;
    std::cin >> a >> b;
    double s = 0.5;
    //(a-1)*s+1>=a
    //(a-1)*s>=a-1
    //(1-a)*s<=1-a
    //s<=1
    while (std::abs(a-b)>0.0001) {
        if (a > b) {
            a = a * s;
            std::cout << '1';
        }
        else {
            a = (a - 1.0) * s + 1.0;
            std::cout << "2";
        }
    }
    std::cout << "\n";
}
int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(0), std::cout.tie(0);
    int t = 1;
    std::cin >> t;
    
    while (t--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3520kb

input:

0.5 0.25

output:


result:

wrong answer wa