题解

211 条题解

  • 0
    @ 2006-11-11 09:53:51

    我用WA十几次的血淋淋的教训告戒大家………………那就是…………………………

    Impossible一定要加感号!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • 0
    @ 2006-11-11 00:11:35

    注意输出"STEP="+k……

    + 注意16进制……

    ---|---|---|---|---|---|---|---|--

    = AC

  • 0
    @ 2006-11-10 23:48:25

    boolean型控制变量错了N次。。。。。。

    怎么数据才4个?~~~~

    AC

  • 0
    @ 2006-11-10 22:46:32

    小心细节.......

    16进制的数不大好直接读入........

    我还出了这样的错...........

    if(A[i]

  • 0
    @ 2006-11-10 22:28:29

    第一次,没有step=

    第二次,没有注意到ABC

    第三次,忘记了第一次改STEP=是直接在提交界面改……

    狂汗……

    要真是noip就完蛋了

  • 0
    @ 2006-11-10 20:56:48

    输出要加个'STEP='...请出题的人抄题目也认真一点

  • 0
    @ 2006-11-10 20:55:23

    啊 我做的又慢了…………>_<

    强烈声讨vijos不许2分钟内重复提交

    强烈声讨出题者不把输出方式说清楚的行为!!

  • 0
    @ 2006-11-11 06:46:35

    WA n次 终于过了

    "给定一个N(2

  • 0
    @ 2007-10-11 13:10:01

    s=‘123456789ABCDEFG’

    a[m]=pos(ch,s)

    就可以了...

    简单题...暴朴素

  • -1
    @ 2019-09-08 00:54:57

    这题我是在训练里做到的
    标签是枚举
    ???
    这题主要还是考字符串处理和进制转换
    如果硬要说是枚举
    那就只能考虑在字符串反转和进制转换时枚举了每一位吧
    就这么理解嗯
    ```cpp
    #include <iostream>
    #include <cstring>
    #include <cmath>
    using namespace std;
    typedef long long LL;
    LL n, tot, l, l1, t, t1;
    char s[107], s1[107];

    inline bool judge(char x[])
    {
    l = strlen(x);
    for (int i = 0; i <= l / 2; ++i)
    if (x[i] != x[l - i - 1])
    return true;
    return false;

    }

    LL Get(char c)
    {
    if (c >= '0' and c <= '9') return c - '0';
    else return c - 'A' + 10;
    }

    char Get(LL c)
    {
    if (c >= 0 and c <= 9) return c + '0';
    else return c - 10 + 'A';
    }

    inline LL calc(char x[])
    {
    l = strlen(x);
    LL tmp, sum = 0;
    for (int i = l - 1; i >= 0; --i)
    {
    tmp = Get(x[i]);
    sum += ((LL)pow(n, l - i - 1) * tmp);
    }
    return sum;
    }

    int main()
    {
    cin >> n >> s;
    while (judge(s) and tot <= 30)
    {
    ++tot;
    l = strlen(s);
    for (int i = 0; i < l; ++i)
    s1[l - i - 1] = s[i];
    t = calc(s), t1 = calc(s1);
    t += t1, l1 = 0;
    while (t)
    {
    s1[l1++] = Get(t % n);
    t /= n;
    }
    for (int i = 0; i < l1; ++i)
    s[l1 - i - 1] = s1[i];
    }
    if (tot <= 30) cout << "STEP=" << tot << endl;
    else cout << "Impossible!\n";
    return 0;
    }
    ```

  • -1
    @ 2017-08-02 11:01:16

    高精度加法,处理好各个进制的进位就行啦

    var n,l,t:longint;m,x:string;
    procedure p;
    var  o:longint;
    begin 
        l:=length(m);x:=m;
        for o:=1 to l do x[o]:=m[l-o+1];
    end;
    function c(q:char):integer;
    begin
        if ord(q)>64 then exit(ord(q)-55)
            else exit(ord(q)-48);
    end;
    procedure add;
    var j,k,w:integer;
    begin
        l:=length(m);x:=x+'0';m:=m+'0';
        for j:=l+1 downto 2 do 
            begin m[j]:=m[j-1];x[j]:=x[j-1];end;
        m[1]:='0';x[1]:='0';
        k:=0;w:=0;
        for j:=l+1 downto 1 do 
            begin 
                k:=c(m[j])+c(x[j])+w;w:=0;
                if k>=n then begin k:=k-n;w:=1;end;
                if k+48>57 then m[j]:=chr(k+55)
                else m[j]:=chr(k+48);
            end;
        if m[1]='0' then begin 
            for j:=1 to l do m[j]:=m[j+1];
            delete(m,l+1,1);
        end;
    end;
    begin
        readln(n);
        read(m);
        p;t:=0;
        repeat
        add;
        t:=t+1;
        p;
        until (t=30)or(m=x);
        if m=x then write('STEP=',t)
        else write('Impossible!');
    end.
    

信息

ID
1304
难度
5
分类
模拟 点击显示
标签
递交数
8080
已通过
2532
通过率
31%
被复制
31
上传者