QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407537#6749. Targetmxxnez#WA 1ms3888kbC++17848b2024-05-08 22:42:402024-05-08 22:42:41

Judging History

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

  • [2024-05-08 22:42:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3888kb
  • [2024-05-08 22:42:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const double esp = 1e-4;
#define i64 long long 
void solve(){
    double a,b;// int cnt = 0;
    cin >> a >> b;
   // cout << a << b;
    if (abs(a - b) <= esp){
        cout << endl;
        return;
    }
    
    double tmp = b;
    vector<int> t;
    int x = 2, cnt = 1;
    
    while (abs(tmp) > esp){
    	
    	while (tmp < 1.0 / x)
    	{
    		x *= 2;
    		cnt++;
		}
    	tmp -= (1.0 / x);
    	tmp = abs(tmp);
    	t.push_back(cnt);
    	x *= 2; cnt++;
	}

	tmp = a;
	for(int i = 0 ; i < 20 ; i++){
		cout << 1;
	}
	for (int i = t.size() - 1; i >= 0; i--){
		cout << 2;
		for (int j = i; j < t[i] - 1; j++)
			cout << 1;
	}
    cout << endl;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	solve();
    return 0;
}

詳細信息

Test #1:

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

input:

0.5 0.25

output:

1111111111111111111121

result:

ok ok

Test #2:

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

input:

1 0.75

output:

1111111111111111111122

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111111111

result:

ok ok

Test #4:

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

input:

0.361954 0.578805

output:

111111111111111111112111111112111111121112112

result:

wrong answer wa