Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
17571 | hhz123 | 【USACO】迷失的奶牛(USACO 2017 OPEN) | C++ | 通过 | 0 MS | 244 KB | 282 | 2023-01-11 14:31:16 |
#include <bits/stdc++.h> using namespace std; int main(){ int x,xn,y,i=1,ans=0; cin>>x>>y; xn=x; while(xn!=y){ while(xn!=x+i){ if(xn==y)break; else{ if(xn>x+i){ xn--; }else{ xn++; } ans++; } } i*=-2; } cout<<ans; }