求助【Cantor表】标题要长—————————————————…
pascal吧
全部回复
仅看楼主
level 12
2013年07月28日 02点07分 1
level 12
题目描述 Description
现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的。他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 2/2 2/3 2/4 … 3/1 3/2 3/3 … 4/1 4/2 … 5/1 … … 我们以Z字形给上表的每一项编号。第一项是1/1,然后是1/2,2/1,3/1,2/2,…
输入描述 Input Description
整数N(1≤N≤10000000)输出描述 Output Description
表中的第N项样例输入 Sample Input
7样例输出 Sample Output
1/4数据范围及提示 Data Size & Hint 见描述
2013年07月28日 02点07分 2
level 12
program t1083; var i,s,n,l,r:longint; pd:boolean; tstr,tt:string; Begin i:=0;s:=0;n:=0; pd:=false; read(n); while i<=5 do begin inc(i); s:=i*(1+i) div 2; if s>=n then begin if (i mod 2)=0 then pd:=false else pd:=true; break; end; end; n:=n-(i*(i-1) div 2); if pd=true then begin l:=i+1-n; r:=i+1-l; end else begin r:=i+1-n; l:=i+1-r; end; str(l,tt); tstr:=tt+'/'; str(r,tt); tstr:=tstr+tt; write(tstr); End.
2013年07月28日 02点07分 3
level 12
为什么只有25分(只对一个)?
2013年07月28日 02点07分 4
level 12
看帖不回扣工资啊
2013年07月28日 02点07分 5
level 12
顶起[惊哭]
2013年07月28日 02点07分 6
level 12
2013年07月28日 02点07分 7
level 1
[]
2015年08月01日 05点08分 8
用得着隔两年挖坟么。。
2015年08月01日 08点08分
level 1

2015年09月30日 13点09分 9
level 1
这题怎么做?
2015年09月30日 13点09分 10
找规律
2015年09月30日 13点09分
level 14
找规律水题,贴我的标程:
var n,m:longint;begin read(n); m:=1; while n>m do begin dec(n,m); inc(m) end; if m and 1=1 then write(m+1-n,'/',n) else write(n,'/',m+1-n)end.
然而本人也不知道cantor表与康托展开有什么关系。。
2015年09月30日 13点09分 11
level 12
这坟挖的
2015年09月30日 18点09分 12
1