Night Diamond - Working Background

UVa 113 - Power of Cryptography

0 comments
Problem link: 113 - Power of Cryptography

  /**********************************************************************\   
  |*********S*** ****** ************ ************* *************** ******|   
  |*********** ******** ************  ************ ************ ** ******|   
  |********* ********** *********** ** *********** * ********* *** ******|   
  |******** *********** *I******** **** ********** *** ***** ***** ******|   
  |******** *********** ********* ****** ********* ***** ** ****** ******|   
  |********** ********* ******** ***A**** ******** ******* ******* ******|   
  |*********** ******** ******* ********** ******* *************** ******|   
  |********** ********* ****** ************ ****** *************** ******|   
  |******** *********** ***** ************** ***** ********M****** ******|   
  |***** ************** **** **************** **** *************** ******|   
  |**********************************************************************|   
  |**************BSMRSTU********************************CSE**************|   
  \**********************************************************************/   
  #include<stdio.h>   
  #include<string.h>   
  #include<math.h>   
  #include<conio.h>   
  #include<stdlib.h>   
  #define ll long long   
  #define B break   
  #define C continue   
  #define sf scanf   
  #define pf printf   
  #define byebye return 0  
 int main()  
 {  
   double k,p,n;  
   while(sf("%lf%lf",&p,&n)==2)  
   {  
     k=pow(n,1/p);  
     pf("%.0lf\n",k);  
   }  
   byebye;  
 }  

Pastebin link: Here

UVa 100 - The 3n+1 problem

0 comments

Problem link: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=36


 /***********************************************************************\  
 |*********S***  ****** ************* ************ **************  ******|  
 |***********  ******** ************  ************  *********** ** ******|  
 |*********  ********** *********** *** ********** * ********* *** ******|  
 |********  *********** *I******** **** ********** *** ***** ***** ******|  
 |********  *********** ********* ****** ********* ***** ** ****** ******|  
 |**********  ********* ******** ***A**** ******** ******* ******* ******|  
 |***********  ******** ******* ********** ******* *************** ******|  
 |**********  ********* ****** ************ ****** *************** ******|  
 |********  *********** ***** ************** ***** ********M****** ******|  
 |*****  ************** **** **************** **** *************** ******|  
 |***********************************************************************|  
 |**************BSMRSTU********************************CSE***************|  
 \***********************************************************************/  
 #include<stdio.h>  
 #include<string.h>  
 #include<math.h>  
 #include<conio.h>  
 #include<stdlib.h>  
 #define ll long long  
 #define B break  
 #define C continue  
 #define sf scanf  
 #define pf printf  
 #define byebye return 0  
 int main()  
 {  
   int a,b;  
   while(sf("%d%d",&a,&b)!=EOF)  
   {  
     pf("%d %d",a,b);  
     if(a>b){  
       int n=a;  
       a=b;  
       b=n;  
     }  
     int i,j,total=0;  
     for(i=a; i<=b; i++)  
     {  
       int count=1;  
       j=i;  
       while(j!=1)  
       {  
         if(j%2)  
         {  
           j=(3*j)+1;  
         }  
         else  
         {  
           j=j/2;  
         }  
         count++;  
       }  
       if(total<count)  
         total=count;  
     }  
     pf(" %d\n",total);  
   }  
   byebye;  
 } 

Pastebin Link : http://pastebin.com/9RZ9nNXm