SGU 169 — Numbers

Posted on 五月 25th, 2008.

bt的数学题.题解看这里:
http://www.mydrs.org/dvp/dispbbs.php?boardid=13&id=43684
2楼说的还算比较详细…我刚开始把题目里P的定义的乘法看成了加法所以一直不懂2楼说的,后来看题之后才发现自己看错了…

{
SGU 169; Numbers
- sqybi’s code
- Maths
}
//for my winsty
program sgu169_sqybi;
  var
    n, t: longint;

  begin
    readln(n);
    if n = 1 then
      writeln(8)
    else begin
      t := 1;
      if (n - 1) mod 3 = 0 then t := t + 2;
      if (n - 1) mod 6 = 0 then t := t + 1;
      writeln(t);
    end;
  end.

阅读(88 次)

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...