题解

337 条题解

  • 0
    @ 2009-09-15 21:39:42

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 150ms

    ├ 测试数据 04:运行超时...

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

    Unaccepted 有效得分:75 有效耗时:150ms

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

    Who can tell me what is wrong with my program ?

    If you can,I will be very happy.Please tell me the mistakes.

    Thank you very much!

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

    (Here is my program:)

    program ex;

    var s1,s2,s:ansistring;

    i,j,p,q,a,b:longint;

    d:array[1..100000000] of integer;

    begin

    readln(s1);readln(s2);

    if length(s2)

  • 0
    @ 2009-09-05 17:12:42

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    哈啊哈 一亿进制=0MS~~

    要注意一开始的进制转换

  • 0
    @ 2009-09-03 20:57:12

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 541ms

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

    Accepted 有效得分:100 有效耗时:541ms

    最简单的高精.

    没有压位.

    一次ac

    #include

    using namespace std;

    int l1,l2,a[10010],b[10010],c[20020];

    string st1,st2;

    void solve()

    {

    int k;

    for (int i=1;i=1;i--)

    cout st1; cin >> st2;

    l1=st1.length(); l2=st2.length();

    for (int i=0;i

  • 0
    @ 2009-08-28 20:50:24

    不用压位高精照样过

    改一改就行了

  • 0
    @ 2009-08-26 16:24:12

    read要用ansistring;

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:运行超时...

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

    Unaccepted 有效得分:75 有效耗时:0ms

    各位看看这个超时

    p:=length(t1);

    q:=length(t2);

    for i:=1 to p do

    a[i]:=ord(t1[p+1-i])-ord('0');

    for i:=1 to q do

    b[i]:=ord(t2[q+1-i])-ord('0');

    for i:=1 to p do

    for j:=1 to q do begin

    k:=i+j-1;

    ans[k]:=ans[k]+a[i]*b[j];

    ans[k+1]:=ans[k+1]+ans[k] div 10;

    ans[k]:=ans[k] mod 10;

    end;

    i:=p+q;

    while ans[i]=0 do i:=i-1;

    for j:=i downto 1 do write(ans[j]);

    writeln;

  • 0
    @ 2009-08-26 15:25:40

    大家要注意啊~~题目非常猥琐啊~~位数是10000位内。普通的string会牺牲啊!!一定要用ansistring~!

  • 0
    @ 2009-08-20 20:25:42

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 494ms

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

    Accepted 有效得分:100 有效耗时:494ms

    不懂万进制,不懂压位,就用了个普通高精乘法,好险!

    #include

    #include

    char x='0',str1[100001],str2[100001],str[100001];

    long i,j,l1,l2,al,p,h1[100001],h2[100001],ans[100020001];

    int jw(long h[])

    {

    int c=0;

    for(i=1;i0)

    {

    al++;

    h[al]=c%10;

    c=c/10;

    }

    }

    int main()

    {

    scanf("%s\n%s",str1,str2);

    l1=strlen(str1);

    l2=strlen(str2);

    for(i=0;i

  • 0
    @ 2009-08-19 21:45:55

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:运行超时...

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

    Unaccepted 有效得分:75 有效耗时:0ms

  • 0
    @ 2009-08-15 20:23:40

    1位高精,好事494

  • 0
    @ 2009-08-15 20:19:48

    AC once!

  • 0
    @ 2009-08-12 22:48:23

    MyProger\Prog12689.cpp:1:19: warning: extra tokens at end of #include directive C:/Vijos/Compiler/GCC/bin/../lib/gcc/mingw32/3.4.2/../../../libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16' collect2: ld returned 1 exit status 

    为撒编译不过捏

  • 0
    @ 2009-08-11 13:08:37

    编译通过...

    ├ 测试数据 01:答案正确... 728ms

    ├ 测试数据 02:答案正确... 728ms

    ├ 测试数据 03:答案正确... 728ms

    ├ 测试数据 04:答案正确... 728ms

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

    Accepted 有效得分:100 有效耗时:2912ms

    好稳定的算法......

  • 0
    @ 2009-08-07 09:25:17

    随便写吧~~~~百进制乘法都可以AC....

  • 0
    @ 2009-08-04 15:05:37

    各位小心啊!

    记得用ansistring啊!

    我就是因为这个改了2次程序

    提交了4次!

    我的通过率啊!

    T_T!

  • 0
    @ 2009-07-31 14:53:01

    咱的高精库。。。

    #include

    using namespace std;

    class INT

    {

    private:

    #define MAX(a,b) ((a)>(b)?(a):(b))

    #define MIN(a,b) ((a)(b)?(a):(b))

    #define min(a,b) ((a) (INT a,INT b)

    {

    if (a.data[0]>b.data[0]) return true;

    if (a.data[0]=1; i--)

    if (a.data[i]>b.data[i]) return true;

    else if (a.datai

    {

    INT _b;

    _b = b;

    return a>_b;

    }

    friend bool operator > (int a,INT b)

    {

    INT _a;

    _a = a;

    return _a>b;

    }

    friend bool operator >= (INT a,INT b)

    {

    if (a.data[0]>b.data[0]) return true;

    if (a.data[0]=1; i--)

    if (a.data[i]b.data[i]) return true;

    return true;

    }

    friend bool operator >= (INT a,int b)

    {

    INT _b;

    _b = b;

    return a>_b;

    }

    friend bool operator >= (int a,INT b)

    {

    INT _a;

    _a = a;

    return _a>b;

    }

    friend bool operator == (INT a,INT b)

    {

    if (a.data[0]!=b.data[0]) return false;

    for (int i = 1; idata[0]++;

    }

    this->data[0] = (this->data[0]data[0]-1;

    return *this;

    }

    INT operator += (INT b)

    {

    *this = *this+b;

    return *this;

    }

    INT operator += (int b)

    {

    *this = *this+b;

    return *this;

    }

    INT operator -= (INT b)

    {

    *this = *this-b;

    return *this;

    }

    INT operator -= (int b)

    {

    *this = *this-b;

    return *this;

    }

    INT operator *= (INT b)

    {

    *this = *this*b;

    return *this;

    }

    INT operator *= (int b)

    {

    *this = *this*b;

    return *this;

    }

    INT operator ++()

    {

    *this += 1;

    return *this;

    }

    INT operator --()

    {

    *this -= 1;

    return *this;

    }

    };

    int main()

    {

    INT a,b;

    cin>>a;

    cin>>b;

    cout

  • 0
    @ 2009-07-29 12:46:29

    数组估计不足,竟死这么多次

  • 0
    @ 2009-07-24 08:47:30

    万进制乘法

    领教了= =

    procedure mul;

    var i, j: longint;

    begin

    for i:= 1 to la do

    for j:= 1 to lb do

    begin

    inc(c,x[i]*y[j]);

    inc(c,c div base);

    c:=c mod base;

    end;

    lc:=la+lb;

    while (lc>1) and (c[lc]=0) do dec(lc);

    end;

    procedure print;

    var i: integer;

    begin

    write(c[lc]);

    for i:= lc-1 downto 1 do

    begin

    if c[i]

  • 0
    @ 2009-07-23 16:19:33

    #include

    #define M 10000

    int al[M],bl[M],c[2*M];

    char a[M],b[M];

    int main()

    {

    int xa,xb,i,h,j;

    scanf("%s",a);

    scanf("%s",b);

    for (xa = 0;a[xa] != '\0' && a[xa] != '\n';xa++);

    for (xb = 0;b[xb] != '\0' && b[xb] !='\n';xb++);

    for (i = 0;i < xa;i++) {

    j = (xa - i - 1) / 4;

    al[j] = al[j]* 10 + a[i] - '0';

    }

    xa = (xa + 3) / 4;

    for (i = 0;i < xb;i++) {

    j = (xb - i - 1) / 4;

    bl[j] = bl[j] * 10 + b[i] - '0';

    }

    xb = (xb + 3) / 4;

    for (i = 0;i < xb;i++) {

    c[i] += al[0] * bl[i];

    for (j = 1;j < xa;j++) {

    c[j+i] += al[j] * bl[i];

    c[j+i] += c[j+i-1] / 10000;

    c[j+i-1] %= 10000;

    }

    }

    xa =xa +xb-1;

    while (c[xa-1] >= 10000) {

    ++xa;

    c[xa-1] = c[xa-2] / 10000;

    c[xa-2] %= 10000;

    }

    while (c[xa] == 0&&xa!=0) {

    xa--;

    }

    printf("%d",c[xa]);

    --xa;

    while (xa >= 0) {

    printf("%d%d%d%d",c[xa] /1000,(c[xa] /100) %10,(c[xa] /10) % 10,c[xa] % 10);

    xa--;

    }

    return 0;

    }

  • 0
    @ 2009-07-27 15:14:00

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

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

    Accepted 有效得分:100 有效耗时:0ms

    var tmp1,tmp2,tmp3:ansistring;

    a,b,c,max1,max2:longint;

    a1,a2:array[1..10000] of integer;

    a3:array[1..20000] of integer;

    procedure huan(var a,b:integer);

    var c:integer;

    begin

    c:=a;

    a:=b;

    b:=c;

    end;

    procedure cf;

    var a,b,c,p:longint;

    d:boolean;

    begin

    for a:=1 to max1 do

    begin

    c:=0;

    for b:=1 to max2 do

    begin

    c:=a3[a+b-1]+c+a1[a]*a2[ b ];

    a3[a+b-1]:=c mod 10000;

    c:=c div 10000;

    end;

    p:=max2+a;

    while c0 do

    begin

    a3[p]:=c mod 10000;

    c:=c div 10000;

    p:=p+1;

    end;

    end;

    d:=false;

    for a:=20000 downto 1 do

    if (d)or(a3[a]0) then

    begin

    if d then

    begin

    if a3[a]

  • 0
    @ 2009-07-21 10:29:36

    嘿嘿

    万进制 终于过了

    哈哈哈 我号佩服我自己

    贴的是彩色代码!!!哈哈

    #include#includechar a[10001]={"0"},b[10001]={"0"};int c[10012]={,};int main(){int lena=,lenb=;int i,j,k;int temp=;long t,r=;int la,lb;int d[4]={};gets(a);gets(b);lena=strlen(a);lenb=strlen(b);for(i=;i

信息

ID
1040
难度
7
分类
高精度 点击显示
标签
(无)
递交数
16686
已通过
3188
通过率
19%
被复制
29
上传者