[POJ1969]Count on Canton
NOIP1999普及组
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 9333 | Accepted: 5469 |
Description
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
In the above diagram, the first term is 1/1, the second term is 1/2, the third term is 2/1, the fourth term is 3/1, the fifth term is 2/2, and so on.
Input
Output
Sample Input
3
14
7
Sample Output
TERM 3 IS 2/1
TERM 14 IS 2/4
TERM 7 IS 1/4
Source
Solutions
模拟打一个Cantor表。
var n,i,m:longint;
procedure main;
begin
readln(n);
m:=n;
i:=;
while n>i do
begin
dec(n,i);
inc(i)
end;
if i mod = then writeln('TERM ',m,' IS ',i+-n,'/',n)
else writeln('TERM ',m,' IS ',n,'/',i+-n);
end;
begin
while not seekeof do
main;
end.
[POJ1969]Count on Canton的更多相关文章
- 算法思考: poj 1969 Count on Canton
A - Count on Canton Time Limit:1000MS Memory Limit:30000KB ...
- 二分- Count on Canton
题目: 代码: 是一个蛇形数列,把题目上的那组数倒过来看成一个正三角形. 第一行有1个数,1-2行有三个数,1-4行有6个数,1-4行有10个数,1-5行有15个数..... 现在要求第n个数是多少, ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
- poj分类
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- 转载 ACM训练计划
leetcode代码 利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcode. ...
- poj 题目分类(1)
poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...
- POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)
本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...
随机推荐
- 网页clientWidth等相关
javascript代码: function getInfo() { var s = ""; s += & ...
- iis7以上版本权限控制
IIS7.5中(仅win7,win2008 SP2,win2008 R2支持),应用程序池的运行帐号,除了指定为LocalService,LocalSystem,NetWorkService这三种基本 ...
- uvision4 ide已停止工作
情景描述: 笔者安装了新系统WIN8.1,装上了MDKV4.72.MDK编译程序可以正常工作,可是只要当我“下载程序”或者“调试程序”的时候就提示“uvision4 ide已停止工作”,迫不得已只能关 ...
- 一步步学习ASP.NET MVC3 (14)——Route路由
请注明转载地址:http://www.cnblogs.com/arhat 由于今天是星期六,所以多写几篇,感觉前几天的忙碌没有及时发布文章,趁着周末老魏尽力的多写几篇文章.因为本系列基本上快结束了,所 ...
- UIAlertView带textField
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"校验登录密码" message:@"" del ...
- Bootstrap 分页功能
function bootstrappage() { var options = { currentPage: currentPage, totalPages: totalPages, size: ' ...
- C++ 数据类型及相关问题 及输出精度控制
1.有哪些数据类型? 2.数据类型在不同的编译器会有不同的位宽,如何得知? 使用如下命令: cout<<sizeof(int)<<endl; cout<<sizeo ...
- js去除重复数值
var c=[2,4,3,5,2,2,2], a = {}, i = 0; for(;i<c.length;i++){ a[c[i]] = 1 //利用对象名称不能重复的特性来去重 } c=[] ...
- Firefly 性能测试 报告
原地址:http://bbs.gameres.com/thread_223724.html Firefly 性能测试 主要考虑点 网络IO的并发 进程间通信压力 数据读写压力 测试机配置: 操作系统 ...
- MySQL db优化
http://blog.csdn.net/likika2012/article/details/38816037 http://www.nowamagic.net/librarys/veda/deta ...