大致题意:使用三进制砝码采取相应的措施衡量出给定的数字
主要思路:三进制,如果 大于 2 向前进位,之前一直没写好放弃了,这次终于写好了……

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <map>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
#include <stack>
#include <cctype> const double Pi = atan() * ; using namespace std;
long long base[] = {,,,,,,,,,,,,,,,,,,,,,};
int a[];
int tt[];
int main()
{
//freopen("input.in","r",stdin);
//freopen("output.in","w",stdout);
int n;
cin >> n;
while(n--){
int x;
cin >> x;
memset(a,,sizeof(a));
memset(tt,,sizeof(tt));
int tmp = x;
while(tmp){
a[++a[] ] = tmp % ;
tmp /= ;
}
for(int i = ;i <= a[];i++){
if(a[i] == ){
a[i+]++;
a[] = max(i+,a[]);
tt[ ++tt[] ] = i;
a[i] = ;
}
if(a[i] == ){
a[i+]++;
a[] = max(i+,a[]);
a[i] = ;
}
}
cout << "left pan:";
for(int i = tt[];i > ;i--){
cout << " " << base[ tt[i] ];
}
cout << endl;
cout << "right pan:";
for(int i = a[];i > ;i--){
if(!a[i])
continue;
cout << " " << base[i];
}
cout << endl;
if(n)
cout << endl;
}
return ;
}

最新文章

  1. Ubuntu 16 安装ElasticSearch
  2. QT中检索设定目录下所有指定文件的方法
  3. ZeroMQ接口函数之 :zmq_init - 初始化ZMQ环境上下文
  4. Qt中2D绘图问题总结(二)----------坐标系统
  5. javascript中的自增与自减
  6. oracle中=&gt;是什么意思
  7. PIL(Python Image Library)生成验证码
  8. 图片左右循环连续滚动代码,解决marquee的留白问题
  9. Linux Curl常用命令使用【转】
  10. Servlet--超链接,表单提交,重定向,转发4种情况的路径
  11. AOP的相关概念
  12. How to change Eclipse loading image
  13. Wavelet Ridgelet Curvelet Contourlet Ripplet
  14. 2018年尚硅谷《全套Java、Android、HTML5前端视频》
  15. 卖给高通之后的CSR的现状和未来
  16. hostswap dcevm
  17. Apache提供的dbUtils
  18. 添加mysqld、apache服务到windows服务
  19. 20170706xlVBA根据工资汇总表生成个人工资条
  20. Fire Game 双向bfs

热门文章

  1. ecshop后台添加栏目
  2. poj 1363 Rails in PopPush City &amp;&amp;【求堆栈中合法出栈顺序次数】
  3. 【深圳,武汉】一加科技(One Plus)招聘,寻找不...
  4. quant_百度百科
  5. [Android] FileInputStream跟踪
  6. zoj 2277 The Gate to Freedom
  7. QTP的基本功能介绍
  8. 用Swift完成不同View Controller之间的切换
  9. AOP编程
  10. Fix Windows 7 Msvcp71.dll And Msvcr71.dll Missing Error