== 이야기 == 처음 생각을 잘못해서 잘못된 곳에서 너무 많이 헤맷다.~~ 0.010초 Accepted~ == 소스 == {{{~cpp #include #include using namespace std; int first, second, sExp, eExp, sNum, eNum; double row, col; double getDistance(int s, int e) { sExp = 0; eExp= 0; row=0.0; col=0.0; if(s==e) return 0.0; sExp = floor(sqrt(s)); sNum = s - sExp*sExp; eExp = floor(sqrt(e)); eNum = e - eExp*eExp; row = (sNum-eNum+(eExp-sExp))/2.0; if(eExp-sExp==0) { if((eNum-sNum)%2==0) col = 0; else col = sqrt(3.0)/6; } else { if(sNum%2==0) col += sqrt(3.0)/6; else col += sqrt(3.0)/3; if(eNum%2==0) col += sqrt(3.0)/3; else col += sqrt(3.0)/6; col+=sqrt(3.0)*(eExp-sExp-1)/2; } return sqrt(row*row+col*col); } int main() { cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint); cout.precision(3); while(cin>>first>>second) { if(second>first) cout << getDistance(first, second)<< endl; else cout << getDistance(second, first)<< endl; } return 0; } }}}