uva_ 575-Skew Binary

When a number is expressed in decimal, the k-th digit represents a multiple of 10k. (Digits are numbered from right to left, where the least significant digit is number 0.) For example, 

\begin{displaymath}81307_{10} = 8 \times 10^4 + 1 \times 10^3 + 3 \times 10^2 + ......mes 10^1 +7 \times 10 0 = 80000 + 1000 + 300 + 0 + 7= 81307.\end{displaymath}

When a number is expressed in binary, the k-th digit represents a multiple of 2k. For example, 

\begin{displaymath}10011_2 = 1 \times 2^4 + 0 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 +1 \times 2^0 = 16 + 0 + 0 + 2 + 1 = 19.\end{displaymath}

In skew binary, the k-th digit represents a multiple of 2k+1 - 1. The only possible digits are 0 and 1, except that the least-significant nonzero digit can be a 2. For example, 

\begin{displaymath}10120_{skew} = 1 \times (2^5 - 1) + 0 \times (2^4-1) + 1 \tim......2 \times (2^2-1) + 0 \times (2^1-1)= 31 + 0 + 7 + 6 + 0 = 44.\end{displaymath}

The first 10 numbers in skew binary are 0, 1, 2, 10, 11, 12, 20, 100, 101, and 102. (Skew binary is useful in some applications because it is possible to add 1 with at most one carry. However, this has nothing to do with the current problem.)

Input 

The input file contains one or more lines, each of which contains an integer  n . If  n  = 0 it signals the end of the input, and otherwise  n  is a nonnegative integer in skew binary.

Output 

For each number, output the decimal equivalent. The decimal value of  n  will be at most  2 31  - 1 = 2147483647.

Sample Input 

10120
200000000000000000000000000000
10
1000000000000000000000000000000
11
100
11111000001110000101101102000
0

Sample Output 

44
2147483646
3
2147483647
4
7
1041110737



Miguel A. Revilla 
1998-03-10
  水题。

#include <iostream>
#include <string>
using namespace std;

int main()
{
    int value[32];


    for( int i = 0; i<32; i++)
    value[i] = (1<<(i+1)) -1;


    string str;
    while ( cin >> str)
    {
        if( str[0] == '0') break;
        
        int len = str.length();
        int ans = 0;
    
        for( int i = len - 1; i >= 0; i--)
            ans += value[len-1-i]*(str[i]-'0');

        cout << ans << endl;
    }

    return 0;
}



### 回答1: toolbox_calib-master是一个用于摄像机标定的MATLAB工具箱,它包含了多个函数和脚本,可以用于摄像机内参和外参的标定,以及图像畸变校正等操作。该工具箱使用的标定方法为张正友标定法,该方法有效地解决了摄像机成像时的畸变问题,能够提高摄像机的精度和稳定性,对于计算机视觉和机器人领域的应用具有重要意义。 通过toolbox_calib-master,用户可以通过输入一组已知的世界坐标和对应的图像坐标,标定出摄像机的内参和外参,包括相机的焦距、主点、畸变系数、旋转矩阵、平移向量等参数。同时,该工具箱还提供了一些辅助函数,可以用于验证标定结果的准确性,如重投影误差的计算和误差分析等。 除了标定操作,toolbox_calib-master还支持图像畸变校正和图像去畸变等操作,可以使摄像机成像更加真实,提高图像质量。此外,该工具箱的使用也十分方便,用户只需要准备好标定所需的图像和参数设置文件,然后运行相应的脚本即可完成标定过程。 总之,toolbox_calib-master是一款实用性强,功能全面的MATLAB工具箱,它在计算机视觉和机器人领域的应用中具有重要作用。 ### 回答2: toolbox_calib-master是一个用于相机标定的工具箱。相机标定是指确定相机的内部参数矩阵和外部参数矩阵,以便在图像处理中进行矫正和重建等操作。 toolbox_calib-master包含了很多的函数和工具来进行相机标定。其中最核心的函数是calib函数,用于执行标定过程。calib函数需要使用标定板图像序列,通过检测标定板上的角点并计算标定板在世界坐标系下的坐标,从而得到相机的内参和外参。 除此之外,toolbox_calib-master还包括了许多辅助函数,如findcorner.m用于检测标定板上的角点,extrinsic.m用于计算外参矩阵,skew.m用于计算相机的非对称畸变等。这些函数的使用可以大大简化相机标定的过程。 总之,toolbox_calib-master是一个非常实用的相机标定工具箱,可用于计算相机的内部和外部参数,为后续的图像处理提供准确的基础。 ### 回答3: toolbox_calib-master是一款开源的相机标定工具箱,可以帮助用户进行相机内外参数的标定。该工具箱的功能非常强大,可以准确地计算出相机的畸变参数、内参矩阵、外参参数和相机坐标系与世界坐标系的映射关系,从而实现对相机的几何校正,可以应用于机器视觉、机器人控制、3D重建等领域。 toolbox_calib-master采用了基于Matlab的GUI界面,便于用户进行参数的调整和可视化。用户只需要提供标定板的特征点图像序列和标定板的物理尺寸,再进行标定图像的选择和标记,即可得到相机的内外参数。该工具箱还支持不同标定板特征点的提取方法,并可以根据用户需求输出相应的标定结果。 同时,toolbox_calib-master还提供了丰富的功能扩展,如计算标定误差、处理非线性畸变等,可以满足用户在不同应用场景下的需求。该工具箱的源代码开放,支持用户进行二次开发和优化,具有广阔的应用前景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值