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

    Dense Subsequence time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  2. Android OpenGL 入门示例----绘制三角形和正方形

    Android上对OpenGl的支持是无缝的,所以才有众多3D效果如此逼真的游戏,在Camera的一些流程中也有用到GLSurfaceView的情况.本文记录OpenGL在Android上的入门级示例 ...

  3. JPA 系列教程7-双向多对多

    双向多对多的ddl语句 同单向多对多表的ddl语句一致 Student package com.jege.jpa.many2many; import java.util.HashSet; import ...

  4. ABI & API

    API defines the programning language and function entry point, arguments type, order. ABI defines th ...

  5. PHP显示超全局变量和显示程序执行时间

    <?php header('Content-type: text/html; charset=utf-8'); $t1 = microtime(true);//记录脚本刚开始运行是的时间戳 ec ...

  6. webservice接口调用存储过程返回失败

    poka.cashman.timer.service.impl.PdaOperateServiceImpl - Method Name: cashBoxOutOrIn; cbInfo:JN002015 ...

  7. AngularJS 基础用法

    判断语句: <li ng-repeat=”person in persons”> <span ng-switch on=”person.sex”> <span ng-sw ...

  8. Linux学习 -- Shell编程 -- 条件判断

    按照文件类型进行判断 两种格式 test -e /root/install.log [ -e /root/install.log ]   注意空格  适合用于脚本中 echo $?可以看到结果 [ - ...

  9. The Importance of Money in Life

    What were you taught about money as you were growing up?something like "Money doesn't grow on t ...

  10. 初学HTML5的一点理解

    刚接触了一点点用h5移动端的一点知识,用自己最浅薄的理解来看解决自适应屏幕尺寸问题和适应屏幕尺寸的布局问题.这里,为了解决自适应屏幕尺寸问题大概需要做的就是把HTML中的元素的尺寸尽可能的用百分比表示 ...