https://www.luogu.org/problemnew/show/P1014

很显然同一对角线的和是相等的。我们求出前缀和然后二分。

最后注意奇偶的顺序是相反的。

#include<bits/stdc++.h>
using namespace std;
#define ll long long int prefix[]; int init(){
prefix[]=;
for(int i=;i<=;i++){
prefix[i]=prefix[i-]+i;
}
//cout<<prefix[65535]<<endl;
} int main(){
init();
int n;
scanf("%d",&n);
int id=lower_bound(prefix,prefix+,n)-prefix;
id--;
int res=n-prefix[id];
int sum=id+;
if(sum%==)
res=sum-res;
printf("%d/%d\n",res,sum-res); }

(水题)洛谷 - P1014 - Cantor表的更多相关文章

  1. 洛谷——P1014 Cantor表

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

  2. 洛谷P1014 Cantor表

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

  3. 洛谷 P1014 Cantor表

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

  4. 洛谷 P1014 Cantor表 Label:续命模拟QAQ

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

  5. [NOIP1999] 提高组 洛谷P1014 Cantor表

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

  6. java实现 洛谷 P1014 Cantor表

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

  7. (模拟) codeVs1083 && 洛谷P1014 Cantor表

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

  8. 洛谷 P1014 Cantor表【蛇皮矩阵/找规律/模拟】

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

  9. 洛谷1014 Cantor表

      水题.随便搞搞就过了. //Serene #include<algorithm> #include<iostream> #include<cstring> #i ...

随机推荐

  1. Thinking in React(翻译)

    下面是React官方文档中的Thinking inReact文章的翻译,第一次翻译英文的文章,肯定有非常多不对的地方,还望多多包涵. 原文地址:https://facebook.github.io/r ...

  2. Solidworks 不能生成实体,因为这将导致厚度为零的零件怎么办

    如下图所示,我认为我长出一块东西根本不会对其他零件有什么影响.   去掉合并结果之后就好了.   钣金要比方钢高出1mm,这样焊接上去才方便.              

  3. XSS学习分支图

    转载请注明出处:http://blog.csdn.net/cym492224103 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2 ...

  4. webpack2 详解

    1.安装 npm install webpack -g npm install webpack -save-dev 2.编辑配置文件 // 引入 path var path=require('path ...

  5. ubuntu如何修改root密码

    安装完Ubuntu后忽然意识到没有设置root密码,不知道密码自然就无法进入根用户下.到网上搜了一下,原来是这麽回事.Ubuntu的默认root密码是随机的,即每次开机都有一个新的root密码.我们可 ...

  6. testng 工程报错java.net.SocketException

    报错如下: java.net.SocketException: Software caused connection abort: socket write error at java.net.Soc ...

  7. Testng 运行报错:"Total tests run: 0, Failures: 0, Skips: 0"以及找不到class文件的问题

    "Total tests run: 0, Failures: 0, Skips: 0" This means that there were no tests executed a ...

  8. lint (software)

    lint (software) - Wikipedia https://en.wikipedia.org/wiki/Lint_(software) A linter or lint refers to ...

  9. js获取三天后的日期

    js获取三天后的日期 setDate getNowAddTreeFormatDate() { var date = new Date(); date.setDate(date.getDate()+3) ...

  10. linux下如何用php读取word

    在实际的工作中遇到到要导入word格式的文件,经过努力,终于成功了. 在linux上用PHP读取WORD文档,其实是使用了 antiword程序把word文档转化为txt文档. 再使用php执行系统命 ...