[vijos P1035] 贪婪的送礼者

为何我要做此等弱智题,只因我太久不码代码,心有所虚…

明天的任务是,做些难题,累了就理房间,实在不行就睡觉,不要做别的事情w 目测自己做不到呢OAO

program vijos_p1035;
var namelist:array[1..10] of string;
    ans:array[1..10] of integer;
    n,i,j,ni,money:integer;
    s,ss:string;
function loc(st:string):integer;
var i:integer;
begin
  i:=1;
  while namelist[i]<>st do inc(i);
  exit(i);
end;
begin {main}
  readln(n);
  for i:=1 to n do
    readln(namelist[i]);
  for j:=1 to n do
    begin
      readln(s);
      readln(money,ni);
      for i:=1 to ni do
        begin
          readln(ss);
          inc(ans[loc(ss)],money div ni);
        end;
      if ni<>0 then dec(ans[loc(s)],money div ni * ni);
    end;
  for i:=1 to n do
    writeln(namelist[i],' ',ans[i]);
end.
贪婪的送礼者

测试数据 #0: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #1: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #2: Accepted, time = 15 ms, mem = 744 KiB, score = 10

测试数据 #3: Accepted, time = 15 ms, mem = 744 KiB, score = 10

测试数据 #4: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #5: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #6: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #7: Accepted, time = 0 ms, mem = 748 KiB, score = 10

测试数据 #8: Accepted, time = 0 ms, mem = 744 KiB, score = 10

测试数据 #9: Accepted, time = 0 ms, mem = 740 KiB, score = 10

Accepted, time = 30 ms, mem = 748 KiB, score = 100

 

转载于:https://www.cnblogs.com/Sky-Grey/p/3817562.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值