BestCoder Round #81 (div.1)A

來源:互聯網
上載者:User

標籤:

水題。。。就是n的三進位後m位

 1 #include<cstdio> 2 #include<cstring> 3 #include<cstdlib> 4 #include<iostream> 5 #include<queue> 6 #include<stack> 7 #include<cmath> 8 #include<algorithm> 9 #include<malloc.h>10 using namespace std;11 #define clc(a,b) memset(a,b,sizeof(a))12 #define inf 0x3f3f3f3f13 const int N=10010;14 #define LL long long15 const double eps = 1e-5;16 const double pi = acos(-1);17 // inline int r(){18 //     int x=0,f=1;char ch=getchar();19 //     while(ch>‘9‘||ch<‘0‘){if(ch==‘-‘) f=-1;ch=getchar();}20 //     while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();}21 //     return x*f;22 // }23 24 int main(){25     int T;26     while(~scanf("%d",&T)){27          while(T--){28             int m;29             LL n;30             scanf("%d %I64d",&m,&n);31             int a[40];32             clc(a,0);33             int k=m;34             LL q=n;35             while(1){36                 a[k]=q%3;37                 q=q/3;38                 k--;39                 if(q==0||k==0)40                     break;41             }42             for(int i=1;i<=m;i++){43                 if(a[i]==0) printf("R");44                 else if(a[i]==1) printf("G");45                 else printf("B");46             }47             printf("\n");48          }49     }50     return 0;51 }
View Code

 

BestCoder Round #81 (div.1)A

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.