접근 방법
1.어거지로 만들어놓긴 했는데, 내일 수정하겠음...
#include<stdio.h>
int main(int argc, char *argv[]) {
int t, x, y;
scanf("%d", &t);
while (t--) {
int i;
scanf("%d %d", &x, &y);
for (i = 1;; i++)
if (y - x <= (long long)(i / 2)*(i / 2 + 1) + i % 2 * (i / 2 + 1))
{
printf("%d\n", i); break;
}
}
return 0;
}
문제,사진 출처 - https://www.acmicpc.net/problem/1011
'Computer Science > Algorithm' 카테고리의 다른 글
알고리즘 문제 풀이 사이트 (0) | 2017.11.27 |
---|---|
[Algorithm/C] BOJ.2750 수 정렬하기 (0) | 2017.11.25 |
[Algorithm/C] BOJ.2438 별찍기 (0) | 2017.11.23 |
[Algorithm/C] BOJ.2775 부녀회장 (2) | 2017.11.22 |
[Algorithm/C] BOJ.1193 분수찾기 (2) | 2017.11.21 |