Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
23729 我要进前十(黄泽远) 【USACO】迷失的奶牛(USACO 2017 OPEN) C++ 解答错误 0 MS 252 KB 350 2023-07-16 16:04:21

Tests(1/10):


#include "iostream" using namespace std; int main(){ int x,y,ans=1,num=0,TAT=1; cin>>x>>y; while(1){ if(ans==1){ if(x+TAT>=y&&x<y){ num+=abs(x-y); cout<<num; break; } ans=0; } else{ if(x-TAT<y&&x>y){ num+=abs(x-y); cout<<num; break; } ans=1; } num+=TAT*2; TAT*=2; } }


测评信息: