【USACO题库】1.1.2 Greedy Gift Givers贪婪的礼物送礼者
2017-11-20 19:30
573 查看
这一题就是判断的时候有一些麻烦,其他的都容易打出来,不过这些代码都很容易想得到。
var a,b:array[1..10] of string[14]; c:array[1..10,1..3] of longint; d:array[1..10,1..9] of string[14]; n,i,j,k:longint; begin readln(n); for i:=1 to n do readln(a[i]); for i:=1 to n do begin readln(b[i]); readln(c[i,1],c[i,2]); for j:=1 to c[i,2] do readln(d[i,j]); end; for i:=1 to n do begin if c[i,1]>0 then begin for j:=1 to c[i,2] do begin k:=1; while d[i,j]<>b[k] do inc(k); c[k,3]:=c[k,3]+c[i,1] div c[i,2]; end; if c[i,2]=0 then c[i,3]:=c[i,3]+c[i,1] else c[i,3]:=c[i,3]+c[i,1] mod c[i,2]; end; end; i:=1; while i<=n do begin for j:=1 to n do if a[i]=b[j] then begin writeln(b[j],' ',c[j,3]-c[j,1]); inc(i); break; end; end; end.
相关文章推荐
- 一大堆的福利之【USACO题库】Greedy Gift Givers贪婪的礼物送礼者
- P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers
- 洛谷P1201[USACO1.1]贪婪的送礼者Greedy Gift Givers
- 洛谷P1201[USACO1.1]贪婪的送礼者Greedy Gift Givers
- 洛谷 1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers
- Greedy Gift Givers贪婪的礼物送礼者
- 洛谷P1201 [USACO1.1]贪婪的送礼者Greedy Gift Givers
- USACO1.1.2 Greedy Gift Givers(贪婪的礼物送礼者)
- usaco Greedy Gift Givers (送礼物)
- 【USACO1.1_2】★Greedy Gift Givers 贪婪的礼物送礼者
- USACO之Section 1.1.2 PROB Greedy Gift Givers
- USACO1.1.2 Greedy Gift Givers
- USACO 1.1.2 - Greedy Gift Givers(模拟)
- [USACO 1.1.2]贪婪的礼物送礼者 (水题又一道)
- [USACO 1.1.2]贪婪的礼物送礼者
- USACO1.1.2--Greedy Gift Givers
- USACO1.1.2 Greedy Gift Givers 贪婪的送礼者
- Usaco 1.1.2 贪婪的送礼者(Greedy Gift Givers)
- Greedy Gift Givers 贪婪的送礼者
- USACO 1.1.2 Greedy Gift Givers