QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420826 | #6749. Target | yyk23610 | TL | 0ms | 3800kb | C++17 | 605b | 2024-05-24 22:41:47 | 2024-05-24 22:41:48 |
Judging History
answer
#include<iostream>
using namespace std;
double js1(double a){
a = 0.5*a;
return a;
}
double js2(double a){
a = 0.5*a+0.5;
return a;
}
int main(){
double a,b;
cin>>a>>b;
// cout<<a<<" "<<b<<endl;
// string str = "";
while(abs(a-b)>0.0001){
double k1 = js1(a);
double k2 = js2(a);
// cout<<k1<<" "<<k2<<endl;
if(a == k1){
a = k2;
cout<<2;
}
else if(a == k2){
a = k1;
cout<<1;
}
else if(abs(k1-b)>abs(k2-b)){
a = k2;
cout<<2;
}
else{
a = k1;
cout<<1;
}
}
// cout<<"a";
// cout<<str;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
input:
0.5 0.25
output:
1
result:
ok ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3664kb
input:
1 0.75
output:
12
result:
ok ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 0
output:
11111111111111
result:
ok ok
Test #4:
score: -100
Time Limit Exceeded
input:
0.361954 0.578805
output:
212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121...