SPOJ Problem 7406:Beehive Numbers
阅读题。。加上等差数列判断。。
#include<cstdio> #include<cmath> int n,s; int main(){ while(scanf("%d",&n)&&n!=-1){ n--; if (n%6){printf("N\n");continue;} n/=3; s=int (sqrt(double(n))); if (s*(s+1)==n)printf("Y\n"); else printf("N\n"); } }
posted on 2015-03-08 18:53 problemcutter 阅读(125) 评论(0) 收藏 举报
浙公网安备 33010602011771号