wojiaocbj

cbj

Mar 22nd, 2022
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4210843
  4.  Created at: Tue Mar 22 2022 21:21:37 GMT+0800 (China Standard Time)
  5.  Problem: 5382  Time: 5 Memory: 1648
  6. */
  7.  
  8. #include<stdio.h>
  9. int main()
  10. {
  11.  unsigned int n,m,j;
  12.  scanf("%u",&j);
  13. if(j==1){puts("Yes\n1");return 1;}
  14.  m=1;
  15.  n=j;
  16.  if(n%2==0){
  17.  while(n%2==0)
  18.  n=n/2;
  19.  if(n==1){
  20.   printf("Yes\n%u",j);}  
  21.  else{
  22.   while(m<j/2)
  23.    m=m*2;
  24.   printf("No\n%u",m);
  25.  }
  26.     }
  27.  else{
  28.     while(m<=(j-1)/2){
  29.     m=m*2;
  30. }
  31.   printf("No\n%u",m);
  32.   }
  33.  
  34.  return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment