QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#526037#6749. Targetlwl2005TL 0ms3980kbC++14362b2024-08-21 10:03:222024-08-21 10:03:22

Judging History

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

  • [2024-08-21 10:03:22]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3980kb
  • [2024-08-21 10:03:22]
  • 提交

answer

#include <iostream>
using namespace std;
double a,b;
char s;
int main()
{
    cin>>a>>b;
    while(abs(a-b)>0.0001)
    {
        if(abs(a*0.5-b)<=abs((a-1)*0.5+1-b))
        {
            a=a*0.5;
            printf("1");
        }
        else
        {
            a=(a-1)*0.5+1;
            printf("2");
        }
    }
    return 0;
}

詳細信息

Test #1:

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

input:

0.5 0.25

output:

1

result:

ok ok

Test #2:

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

input:

1 0.75

output:

12

result:

ok ok

Test #3:

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

input:

1 0

output:

11111111111111

result:

ok ok

Test #4:

score: -100
Time Limit Exceeded

input:

0.361954 0.578805

output:

212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...

result: