zoukankan      html  css  js  c++  java
  • BestCoder Round #81 (div.1)A

    水题。。。就是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 0x3f3f3f3f
    13 const int N=10010;
    14 #define LL long long
    15 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("
    ");
    48          }
    49     }
    50     return 0;
    51 }
    View Code
  • 相关阅读:
    jQuery中常用方法和jQuery思维导图
    jQuery
    JS-AJAX and jQuery-AJAX
    Linux系统里导入maven项目
    maven项目里的ssh框架整合
    spring框架的两大核心:IOC和AOP
    JAVA的抽象类和接口
    JAVA面向对象的三大特征
    JAVA---面向对象
    JAVA---方法
  • 原文地址:https://www.cnblogs.com/ITUPC/p/5422998.html
Copyright © 2011-2022 走看看