Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
17575 | 孤独摇滚!hts | 【USACO】迷失的奶牛(USACO 2017 OPEN) | C++ | 解答错误 | 0 MS | 244 KB | 376 | 2023-01-11 14:36:16 |
#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){ sum+=abs(x-y); cout<<sum; break; } step=0; }else{ if(x-si<=y){ sum+=abs(x-y); cout<<sum; break; } step=1; } sum+=si*2; si*=2; } return 0; }