HDU1719 Friend (数学推导)
时间:2014-04-30 01:43:36
收藏:0
阅读:322
friend numbers = 2^x + 3^y -1
1 #include<stdio.h> 2 int main() 3 { 4 __int64 a; 5 while(scanf("%I64d",&a)!=EOF) 6 { 7 if(!a) 8 { 9 printf("NO!\n"); 10 continue; 11 } 12 a+=1; 13 while(a%2==0||a%3==0) 14 { 15 if(a%2==0) a/=2; 16 if(a%3==0) a/=3; 17 } 18 if(a==1) printf("YES!\n"); 19 else printf("NO!\n"); 20 } 21 }
评论(0)