2011-12-30 18:25:02
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1597
题意:中文。。。
mark:要用long long。
代码:
# include <stdio.h>
# include <math.h>
int main ()
{
long long n, a ;
scanf ("%I64d", &n) ;
while (~scanf ("%I64d", &n))
{
a = (sqrt(1.0+8.0*n)-1) / 2 ;
if (a*(a+1)/2 == n) a-- ;
n = n-(a*(a+1)/2)-1 ;
n %= 9 ;
printf ("%I64d\n", n+1) ;
}
return 0 ;
}