题目描述 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

见描述

思路 模拟+统计

 #include<cmath>
 #include<cstdio>
 #include<string>
 #include<cstring>
 #include<iostream>
 #include<algorithm>
 using namespace std;
 int re(int a,int b)
 {
     cout<<a<<'/'<<b<<endl;
     ;
 }
 int main()
 {
     int n;
     cin>>n;
     ,i=,j=;
     ,J=;
     <)
     {
         )
         {
             if(I)
             {
                 if(x==n)
                 {
                     re(i,j);
                     ;
                 }
                 j++;
                 x++;
             }
             )
                 {
                     if(x==n)
                     {
                         re(i,j);
                         ;
                     }
                     i++;
                     j--;
                     x++;
                 }
             I=!I;
         }
         &&i!=)
         {
             if(J)
             {
                 if(x==n)
                 {
                     re(i,j);
                     ;
                 }
                 i++;
                 x++;
             }
             )
                 {
                     if(x==n)
                     {
                         re(i,j);
                         ;
                     }
                     i--;
                     j++;
                     x++;
                 }
             J=!J;
         }
     }
     cout<<i<<'/'<<j<<endl;
     ;
 }

Cantor表 1083的更多相关文章

  1. 【CodeVS】1083 Cantor表

    1083 Cantor表 1999年NOIP全国联赛普及组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题目描述 Description 现代数学的著名证明之 ...

  2. wikioi 1083 Cantor表

    题目描述 Description 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 - 2/1 2/ ...

  3. NOIP199904求Cantor表

    求Cantor表 题目描述 Description 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 ...

  4. Cantor表(NOIP1999)

    题目链接:Cantor表 这道题很水,但有的人没看懂题意,这不怪大家,怪题目没说清楚. 给张图: 看到这,你应该明白题目意思了. 先看看有什么规律. 我把这个数列写出来: 1/1,1/2,2/1,3/ ...

  5. 14. Cantor表

    时间限制: 1 s 空间限制: 128000 KB 题目等级 : 白银 Silver 题解 查看运行结果 题目描述 Description 现代数学的著名证明之一是Georg Cantor证明了有理数 ...

  6. 洛谷——P1014 Cantor表

    P1014 Cantor表 题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 ...

  7. 洛谷P1014 Cantor表

    P1014 Cantor表 题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 ...

  8. 洛谷 P1014 Cantor表

    P1014 Cantor表 题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1 1/2 1/3 1/4 1/5 … 2/1 ...

  9. C语言程序设计100例之(3): Cantor表

    例3    Cantor表 题目描述 现代数学的著名证明之一是Georg Cantor证明了有理数是可枚举的.他是用下面这一张表来证明这一命题的: 1/1  1/2  1/3  1/4  …… 2/1 ...

随机推荐

  1. OpenGL红宝书例3.1 -- glBufferSubData使用

    代码实现 1.1 C++部分 GLFWwindow *window; GLuint shader_program; GLuint VAO; void init() { static const GLf ...

  2. JS学习之动态加载script和style样式

    前提:我们可以把一个网页里面的内容理解为一个XML或者说网页本身也就是一个XML文档,XML文档都有很特殊的象征:"标签"也叫"节点".我们都知道一个基本的网页 ...

  3. hdu 5532

    input 1<=T<=2000 2<=n<=10e5 a1 a2 ... an 1<=ai<=10e5 最多二十个n>1000 output 能否从数组中移 ...

  4. Converting between IEEE 754 and Float (Format related

    The float can be converted to well known single-precision IEEE 754 number, why 754? It's the standar ...

  5. C --> OC with RunTime

    前言 本来打算写一篇关于runtime的学习总结,无奈长篇大论不是我的风格,就像写申论一样痛苦,加之网上关于tuntime的文章多如牛毛,应该也够童子们学习的了,今天就随便聊聊我的理解吧. runti ...

  6. Co-Debugging JNI with Android Studio and Visual Studio

    Tutorials > Android > Integration with other tools > Co-Debugging JNI with Android Studio a ...

  7. 2016-3-6.16:43------------js开始

    -------------------------------------------------------------------

  8. vmware卸载问题

    1. VMware版本问题:http://www.wuji8.com/meta/15866846.html2. VMware卸载问题:http://www.veryhuo.com/a/view/716 ...

  9. 命令行编译swc

    compc -source-path . -include-classes com.boyaa.landlo rd.module.room.RoomMain -output a.swc -compil ...

  10. CSS的命名

    使用约定俗称的命名规范有助于我们的代码阅读和维护. 常用命名: wrap  外套       ———————— 用于最外层 container 容器  ————————  和外套相似,用于做容器 he ...