SGU 115 — Calendar

Posted on 五月 9th, 2008.

最后一次写水题的题解…
太麻烦了..懒得写了.

随便算一下就好.

{
SGU 115; Calendar
- sqybi’s code
}
//for my winsty
program sgu115_sqybi;
  const
    p: array[1..12]of longint = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

  var
    n, m, s, i: longint;

  begin
    readln(n, m);
    if (m > 12) or (n > p[m]) then
      writeln(’Impossible’)
    else begin
      s := n;
      for i:=1 to m-1 do s := s + p[i];
      s := s mod 7;
      if s = 0 then s := 7;
      writeln(s);
    end;
  end.

阅读(50 次)

Make a Comment

Make A Comment: ( None so far )

blockquote and a tags work here.

Liked it here?
Why not try sites on the blogroll...