标签:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5670
2 3 1 2 3
RRG GR
<pre name="code" class="cpp">#include <iostream> #include <cstdio> #include <cmath> using namespace std; __int64 ans[110],time[110],s[110]; __int64 Pow(int x,int y) { __int64 ss=1; for (int i=1;i<=y;i++) ss*=x; return ss; } int main() { int t; scanf("%d",&t); while (t--) { __int64 n,m; scanf("%I64d%I64d",&m,&n); int k=0; for (int i=m;i>=1;i--) { s[i]=Pow(3,k); k++; } for (int i=1;i<=m;i++) { time[i]=n/s[i]; ans[i]=time[i]%3; if (ans[i]==0) printf ("R"); else if (ans[i]==1) printf ("G"); else if (ans[i]==2) printf ("B"); } printf ("\n"); } return 0; }
标签:
原文地址:http://blog.csdn.net/qiqi_skystar/article/details/51254555