1 条题解
-
0
Pascal :
const temp : array[1..6] of longint = (2,3,4,5,6,7); function max(a : longint) : longint; begin if a > 4 then max := a else max := 4; end; var n, m, i, s1, s2, r : longint; a, b : array[1..36] of longint; begin readln(n, m); for i := 1 to n-1 do begin read(a[i]); s1 := s1 + a[i]; end; readln(a[n]); if n <= 30 then if n mod 2 > 0 then if a[n] = 1 then begin s1 := s1 + a[n]; r := n div 2 + 1; n := n + 1; end else begin s2 := s2 + max(a[n]); r := n div 2; end else if (a[n] = 1) or (a[n] = 0) then begin s2 := s2 + 4; r := n div 2; end else begin s1 := s1 + a[n]; r := n div 2; end else if a[n] = temp[n-30] then begin s1 := s1 + a[n]; r := 15; end else begin s2 := s2 + max(a[n]); r := 15; end; for i := 1 to m-1 do begin read(b[i]); s2 := s2 + b[i]; end; readln(b[m]); if m <= (15-r) * 2 then if m mod 2 > 0 then if b[m] = 1 then s2 := s2 + b[m] else s1 := s1 + max(b[m]) else if (b[m] = 1) or (b[m] = 0) then s1 := s1 + 4 else s2 := s2 + b[m] else if b[m] = temp[m+n-30] then s2 := s2 + b[m] else s1 := s1 + max(b[m]); writeln(s1, ' ', s2); end.
- 1
信息
- ID
- 1373
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者