191 条题解

  • 0
    @ 2009-02-04 15:54:55

    #include

    #include

    int np;

    int temp[20];

    struct pe

    {

    char name[20];

    int money;

    int back;

    int fri;

    int temp;

    char frd[20][20];

    }pe[20];

    struct pe *search(char name[20])

    {

    struct pe *t=&pe[0];

    while(1)

    {

    if(!(strcmp(name,t->name))){return t;break;}

    t++;

    }

    }

    int give()

    {

    struct pe *p=&pe[0];

    struct pe *tail=&pe[np-1];

    struct pe *g;

    int i=0;

    while(pfri!=0)

    {

    p->temp=(int)(p->money/p->fri);

    p->money=p->money%p->fri;

    }

    p++;

    }

    p=&pe[0];

    while(pfrd[i]);

    g->money+=p->temp;

    }

    p++;

    }

    }

    int compare()

    {

    struct pe *p=&pe[0];

    struct pe *tail=&pe[np-1];

    while(pname,p->money-p->back);

    p++;

    }

    }

    int main()

    {

    char temp[20];

    int j,i;

    struct pe *p=&pe[0];

    scanf("%d",&np);

    for(i=0;iname);

    for(i=0;imoney,&p->fri);

    if(j=p->fri)

    {

    for(j--;j>=0;j--)

    scanf("%s",p->frd[j]);

    }

    }

    for(i=0;i

  • 0
    @ 2009-02-01 16:28:51

    #include

    #include

    int main() {

    char names[10][15],tname[15];

    int np,i,ng,j,present,togive,gp,rp;

    int given[10],received[10];

    scanf("%d",&np);

    for(i=0;i

  • 0
    @ 2009-01-30 21:30:40

    看懂题目就行了,绝对的基础

    初学者以外的可以不做了(提高AC率的随便吧)

    C的初学者,贴段C的吧

    #include

    #include

    long np;

    char name[10][255];

    int find(char st[255])

    {

    long i;

    for(i=1;i

  • 0
    @ 2009-01-21 15:22:39

    type

    gift=

      record

       ans,money,ngi:integer;

       ng:array [1..10] of string;

       n:string;

      end;

    var

    np,i,j,k,m:integer;

    s:array [1..10] of gift;

    str:string;

    begin

    for i:=1 to 10 do s[i].ans:=0;

    readln(np);

    for i:=1 to np do readln(s[i].n);

    for i:=1 to np do

      begin

       readln(str);

       for j:=1 to np do if s[j].n=str then m:=j;

       readln(s[m].money,s[m].ngi);

       for j:=1 to s[m].ngi do readln(s[m].ng[j]);

      end;

    for i:=1 to np do if s[i].ngi>0 then

      begin

       s[i].ans:=s[i].ans-s[i].money div s[i].ngi*s[i].ngi;

       for j:=1 to s[i].ngi do for k:=1 to np do if s[i].ng[j]=s[k].n then s[k].ans:=s[k].ans+s[i].money div s[i].ngi;

      end;

    for i:=1 to np do writeln(s[i].n,' ',s[i].ans);

    end.

  • 0
    @ 2009-01-20 17:21:22

    TASK: gift1

    LANG: PASCAL

    Compiling...

    Compile: OK

    Executing...

    Test 1: TEST OK [0.000 secs, 208 KB]

    Test 2: TEST OK [0.000 secs, 208 KB]

    Test 3: TEST OK [0.000 secs, 212 KB]

    Test 4: TEST OK [0.000 secs, 212 KB]

    Test 5: TEST OK [0.000 secs, 212 KB]

    Test 6: TEST OK [0.000 secs, 208 KB]

    Test 7: TEST OK [0.000 secs, 212 KB]

    Test 8: TEST OK [0.000 secs, 208 KB]

    Test 9: TEST OK [0.000 secs, 208 KB]

    All tests OK.

    Your program ('gift1') produced all correct answers! This is your

    submission #7 for this problem. Congratulations!

    Here are the test data inputs:

    ---|---|- test 1 ---|---|-

    10

    mitnik

    Poulsen

    Tanner

    Stallman

    Ritchie

    Baran

    Spafford

    Farmer

    Venema

    Linus

    mitnik

    300 3

    Poulsen

    Tanner

    Baran

    Poulsen

    1000 1

    Tanner

    Spafford

    2000 9

    mitnik

    Poulsen

    Tanner

    Stallman

    Ritchie

    Baran

    Farmer

    Venema

    Linus

    Tanner

    1234 1

    Poulsen

    Stallman

    536 3

    Farmer

    Venema

    Linus

    Ritchie

    2000 1

    mitnik

    Baran

    79 2

    Tanner

    Farmer

    Farmer

    0 0

    Venema

    12 9

    mitnik

    Poulsen

    Tanner

    Stallman

    Ritchie

    Baran

    Spafford

    Farmer

    Linus

    Linus

    1000 1

    mitnik

    ---|---|- test 2 ---|---|-

    5

    dave

    laura

    owen

    vick

    amr

    dave

    200 3

    laura

    owen

    vick

    owen

    500 1

    dave

    amr

    150 2

    vick

    owen

    laura

    0 2

    amr

    vick

    vick

    0 0

    ---|---|- test 3 ---|---|-

    2

    john

    lennon

    lennon

    0 0

    john

    0 0

    ---|---|- test 4 ---|---|-

    10

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Alex

    2000 9

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Bob

    2000 9

    Alex

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Catherine

    2000 9

    Alex

    Bob

    Dave

    Ebert

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Dave

    2000 9

    Alex

    Bob

    Catherine

    Ebert

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Ebert

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Francis

    Godot

    Harris

    Iliya

    Jimbo

    Francis

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Godot

    Harris

    Iliya

    Jimbo

    Godot

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Harris

    Iliya

    Jimbo

    Harris

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Iliya

    Jimbo

    Iliya

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Harris

    Jimbo

    Jimbo

    2000 9

    Alex

    Bob

    Catherine

    Dave

    Ebert

    Francis

    Godot

    Harris

    Iliya

    ---|---|- test 5 ---|---|-

    4

    these

    names

    are

    dumb

    dumb

    534 3

    these

    dumb

    are

    are

    351 1

    names

    these

    509 2

    dumb

    names

    names

    278 1

    dumb

    ---|---|- test 6 ---|---|-

    2

    someguy

    someotherguy

    someotherguy

    1500 1

    someguy

    someguy

    500 1

    someotherguy

    ---|---|- test 7 ---|---|-

    8

    a

    b

    c

    d

    e

    f

    g

    h

    c

    500 4

    a

    b

    d

    h

    f

    290 3

    a

    b

    c

    a

    489 7

    b

    c

    d

    e

    f

    h

    g

    g

    0 0

    e

    1789 2

    f

    h

    d

    2000 5

    a

    b

    h

    f

    e

    b

    192 5

    a

    c

    h

    g

    d

    h

    0 2

    a

    b

    ---|---|- test 8 ---|---|-

    10

    paul

    stan

    mark

    doug

    fred

    bill

    hank

    rich

    mike

    john

    paul

    0 0

    john

    300 2

    paul

    stan

    stan

    1000 1

    paul

    mark

    2000 3

    paul

    stan

    doug

    doug

    510 2

    paul

    stan

    fred

    1560 2

    paul

    stan

    bill

    178 2

    paul

    stan

    hank

    97 2

    paul

    stan

    rich

    1999 2

    paul

    stan

    mike

    1531 2

    paul

    stan

    ---|---|- test 9 ---|---|-

    10

    paul

    stan

    mark

    doug

    fred

    bill

    hank

    rich

    mike

    john

    paul

    1693 6

    stan

    mark

    doug

    fred

    bill

    hank

    john

    1843 3

    hank

    mike

    paul

    stan

    1346 9

    paul

    mark

    fred

    bill

    doug

    hank

    rich

    mike

    john

    mark

    1657 1

    paul

    doug

    1256 9

    paul

    stan

    bill

    mark

    fred

    rich

    hank

    mike

    john

    fred

    1250 6

    paul

    stan

    bill

    rich

    john

    mike

    bill

    1999 2

    john

    mike

    hank

    2000 8

    stan

    mark

    doug

    fred

    rich

    bill

    mike

    john

    rich

    1999 3

    paul

    bill

    hank

    mike

    1999 5

    hank

    bill

    mark

    rich

    john

    Keep up the good work!

    Thanks for your submission!

  • 0
    @ 2009-01-20 16:22:51

    Prog9873.pas(18,1) Fatal: illegal character "'?" ($E3)

    Fatal: Compilation aborted

    为什么会这样,我在自己的机子上做都对

  • 0
    @ 2009-01-18 20:17:30

    也算练习了字符串吧

  • 0
    @ 2009-01-03 19:43:40

    type

    peo=record

    n:string;

    m:integer;

    end;

    var

    a:array [1..10] of peo;

    n,m,b,q,w,e:integer;

    r:string;

  • 0
    @ 2009-01-02 01:33:05

    #include

    using namespace std;

    int N;

    struct people

    {

    string name;

    int give;

    int get;

    }p[10];

    int num(string name)

    {

    for(int i=0;i>N;

    for(i=0;i>p[i].name;

    for(i=0;i>name>>give>>n;

    if(n!=0) p[num(name)].give=give-give%n;

    for(int j=0;j>name;

    p[num(name)].get+=give/n;

    }

    }

    for(i=0;i

  • 0
    @ 2008-12-23 18:04:37

    #include

    #include

    #include

    typedef struct

    {char name[20];

    int m,g;

    int people[11];

    }hp1;

    int main(int argc, char *argv[])

    {int i,np,j,k,m,n,earn,t,a[100]={0};

    hp1 f[11];char p[100],s[100];

    scanf("%d",&np);

    for(i=1;i

  • 0
    @ 2008-12-16 13:15:21

    i love you

  • 0
    @ 2008-12-13 19:45:57

    水题 15分钟

    var a:array[1..10] of string; 名称

    b:array[1..10] of integer; 盈亏

    tp:string; 暂存每次输入的人名(指名单中的)

    m,n,i,j,tmp,tp1,tp2,tp3:integer;

    变量够了。

    function chk(x:string):integer;

    var i:integer;

    begin

    for i:=1 to n do if x=a[i] then exit(i);

    end;

    判断用。。。

    就这么多。。。。。。。

  • 0
    @ 2008-12-08 13:29:27

    type

    gift=

    record

    ans,money,ngi:integer;

    ng:array [1..10] of string;

    n:string;

    end;

    var

    np,i,j,k,m:integer;

    s:array [1..10] of gift;

    str:string;

    begin

    for i:=1 to 10 do s[i].ans:=0;

    readln(np);

    for i:=1 to np do readln(s[i].n);

    for i:=1 to np do

    begin

    readln(str);

    for j:=1 to np do if s[j].n=str then m:=j;

    readln(s[m].money,s[m].ngi);

    for j:=1 to s[m].ngi do readln(s[m].ng[j]);

    end;

    for i:=1 to np do if s[i].ngi>0 then

    begin

    s[i].ans:=s[i].ans-s[i].money div s[i].ngi*s[i].ngi;

    for j:=1 to s[i].ngi do for k:=1 to np do if s[i].ng[j]=s[k].n then s[k].ans:=s[k].ans+s[i].money div s[i].ngi;

    end;

    for i:=1 to np do writeln(s[i].n,' ',s[i].ans);

    end.

  • 0
    @ 2008-11-28 18:27:55

    var

    t:string;

    a:array[1..10]of record

    name:string;

    b:array[1..9]of string;

    s,get,money,ngi:longint;

    end;

    np,i,j,k:longint;

    begin

    readln(np);

    for i:=1 to np do readln(a[i].name);

    for i:=1 to np do

    begin

    readln(t);

    for j:=1 to np do if a[j].name=t then break;

    readln(a[j].money,a[j].ngi);

    if a[j].ngi0 then

    begin

    a[j].money:=a[j].money-(a[j].money-((a[j].money div a[j].ngi)*a[j].ngi));

    for k:=1 to a[j].ngi do

    readln(a[j].b[k]);

    end;

    end;

    for i:=1 to np do

    for j:=1 to a[i].ngi do

    for k:=1 to np do

    if (a[k].name=a[i].b[j]) then

    a[k].get:=a[k].get+(a[i].money div a[i].ngi);

    for i:=1 to np do

    begin

    a[i].s:=(a[i].get-a[i].money);

    write(a[i].name,' ');

    writeln(a[i].s);

    end;

    end.

  • 0
    @ 2008-11-26 17:02:05

    type

    gift=

      record

       ans,money,ngi:integer;

       ng:array [1..10] of string;

       n:string;

      end;

    var

    np,i,j,k,m:integer;

    s:array [1..10] of gift;

    str:string;

    begin

    for i:=1 to 10 do s[i].ans:=0;

    readln(np);

    for i:=1 to np do readln(s[i].n);

    for i:=1 to np do

      begin

       readln(str);

       for j:=1 to np do if s[j].n=str then m:=j;

       readln(s[m].money,s[m].ngi);

       for j:=1 to s[m].ngi do readln(s[m].ng[j]);

      end;

    for i:=1 to np do if s[i].ngi>0 then

      begin

       s[i].ans:=s[i].ans-s[i].money div s[i].ngi*s[i].ngi;

       for j:=1 to s[i].ngi do for k:=1 to np do if s[i].ng[j]=s[k].n then s[k].ans:=s[k].ans+s[i].money div s[i].ngi;

      end;

    for i:=1 to np do writeln(s[i].n,' ',s[i].ans);

    end.

  • 0
    @ 2008-11-24 17:52:16

    好简单的,别自己想复杂了

  • 0
    @ 2008-11-23 14:29:16

    函数里忘打局部变量i了,3次WA,愁死我

  • 0
    @ 2008-11-21 18:50:10

    type

    gift=

    record

    ans,money,ngi:integer;

    ng:array [1..10] of string;

    n:string;

    end;

    var

    np,i,j,k,m:integer;

    s:array [1..10] of gift;

    str:string;

    begin

    for i:=1 to 10 do s[i].ans:=0;

    readln(np);

    for i:=1 to np do readln(s[i].n);

    for i:=1 to np do

    begin

    readln(str);

    for j:=1 to np do if s[j].n=str then m:=j;

    readln(s[m].money,s[m].ngi);

    for j:=1 to s[m].ngi do readln(s[m].ng[j]);

    end;

    for i:=1 to np do if s[i].ngi>0 then

    begin

    s[i].ans:=s[i].ans-s[i].money div s[i].ngi*s[i].ngi;

    for j:=1 to s[i].ngi do for k:=1 to np do if s[i].ng[j]=s[k].n then s[k].ans:=s[k].ans+s[i].money div s[i].ngi;

    end;

    for i:=1 to np do writeln(s[i].n,' ',s[i].ans);

    end.

  • 0
    @ 2008-11-18 12:03:14

    usaco 1.1.2……

    删掉文件读入读出直接copy……

  • 0
    @ 2008-11-11 16:23:12

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

信息

ID
1035
难度
2
分类
模拟 点击显示
标签
(无)
递交数
5216
已通过
2897
通过率
56%
被复制
19
上传者