Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
那位大牛 帮我 找个测试用例 ,证明我错在哪了 谢谢!!#include <stdio.h> #include <math.h> int main(void) { int N; int i; int nums = 0,temp; scanf("%d",&N); for (i = 1; i <= N; i++) { temp = (int)(((1 - 2*i) + sqrt((double)(4*i*i-4*i+1+8*N)))/2.0); if(temp >= 1) { if (N == (temp*i + temp*(temp-1)/2)) { nums++; } else if (N == ((temp+1)*i + temp*(temp+1)/2)) { nums++; } } } printf("%d\n",nums); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator