1 条题解
-
0
Pascal :
var t,tt,i,m,n,a,b:longint; sum:array[0..1000] of longint; begin readln(n,m); for i:=1 to m do begin readln(a,b); inc(sum[a],b); end; for i:=0 to 1000 do begin if sum[i]<>0 then begin inc(t,i*sum[i]); inc(tt,sum[i]); end; if tt>=n then break; end; t:=t-(tt-n)*i; writeln(t); end.
- 1
信息
- ID
- 2753
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者