I

来源:互联网 发布:系统仿真软件 编辑:程序博客网 时间:2024/05/16 18:31

题意:

给出一个map,询问对应点的坐标

思路:

找规律可得。x*2 + z   y*2+z 对于每个0 1  2 3  分情况讨论


#include <iostream>#include <stdio.h>#include <cstring>#include <algorithm>#include <vector>using namespace std;char s[200];int main(){    cin>>s;    cout<<strlen(s);    long long  x=0,y=0;    for(int i=0;s[i];i++)    {        if(s[i]=='0')        {            x*=2;            y*=2;        }else if(s[i]=='1')        {            x*=2;            y*=2;            x++;        }        else if(s[i]=='2')        {            x*=2;            y*=2;            y++;        }        else{            x*=2;            y*=2;            x++,y++;        }    }    cout<<" "<<x<<" "<<y<<endl;    return 0;}