|  | 
|  | 
| back to board | ce Posted by hhh  31 Dec 2008 19:41#include <iostream>using namespace std;
 int main()
 { int n,x=0,s=0,y=1,i;
 cin>>n;
 while(x<=n) ( x+=3; s++; }
 if(n%3==0) { for(i=0; i<s; i++) y*=3; cout<<y<<endl; }
 if(n%3==1) { for(i=0; i<(s-1); i++) y*=3; cout<<(4*y)<<endl; }
 if(n%3==2) { for(i=0; i<s; i++) y*=3; cout<<(2*y)<<endl; }
 return 0; }
 | 
 | 
|