标签:nyoj 215 sum
3 12 0
2 7
AC码:
#include<stdio.h> int main() { int n,i,t; while(scanf("%d",&n)&&n) { i=1; t=1; while(t!=n) { i++; t=i*(i+1)/2; if(t>n) { if((t-n)%2==0) t=n; } } printf("%d\n",i); } return 0; }
标签:nyoj 215 sum
原文地址:http://blog.csdn.net/u012804490/article/details/24668311