【HDOJ】1597 find the nth digit

二分。

 #include <stdio.h>
#include <math.h> int main() {
int case_n;
double n, tmp, l, r;
int m; scanf("%d", &case_n); while (case_n--) {
scanf("%lf", &n);
tmp = sqrt(n+n);
tmp = ceil(tmp);
l = (tmp*tmp-tmp)/;
r = (tmp*tmp+tmp)/;
while ( !(l<n && r>=n) ) {
--tmp;
l = (tmp*tmp-tmp)/;
r = (tmp*tmp+tmp)/;
}
m = (int)(n-l);
m %= ;
if (m==) m=;
printf("%d\n", m);
} return ;
}
上一篇:Struts笔记二:栈值的内存区域及标签和拦截器


下一篇:(转)spring中的拦截器(HandlerInterceptor+MethodInterceptor)