Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
17576 孤独摇滚!hts 【USACO】迷失的奶牛(USACO 2017 OPEN) C++ 通过 0 MS 248 KB 383 2023-01-11 14:37:35

Tests(10/10):


#include <bits/stdc++.h> using namespace std; int main(){ int x,y,sum=0,si=1; bool step=1; cin>>x>>y; while(1){ if(step==1){ if(x+si>=y and x<y){ sum+=abs(x-y); cout<<sum; break; } step=0; }else{ if(x-si<=y and x>y){ sum+=abs(x-y); cout<<sum; break; } step=1; } sum+=si*2; si*=2; } return 0; }


测评信息: