CY_

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2014年3月20日

摘要: // 代码老是粘在最上面,就把题目当做注释放在代码里了/***标题:错误票据 某涉密单位下发了某种票据,并要在年终全部收回。 每张票据有唯一的ID号。全年所有票据的ID号是连续的,但ID的开始数码是随机选定的。 因为工作人员疏忽,在录入ID号的时候发生了一处错误,造成了某个ID断号,另外一个ID重号。 你的任务是通过编程,找出断号的ID和重号的ID。 假设断号不可能发生在最大和最小号。要求程序首先输入一个整数N(N#include#include using namespace std;char str[100][10000] = {' '};int num[10... 阅读全文
posted @ 2014-03-20 15:19 CY_ 阅读(219) 评论(0) 推荐(0) 编辑

2014年3月9日

摘要: Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes a problem, there is only one railway where all the 阅读全文
posted @ 2014-03-09 20:37 CY_ 阅读(176) 评论(0) 推荐(0) 编辑

2013年9月13日

摘要: 母牛的故事Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33371Accepted Submission(s): 16459Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0using namespace std;int a[60] = {0};voi 阅读全文
posted @ 2013-09-13 20:50 CY_ 阅读(157) 评论(0) 推荐(0) 编辑

摘要: u Calculate eProblem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.OutputOutput the approximations of e generated by the above formula for the values of n from 0 to 9 阅读全文
posted @ 2013-09-13 20:06 CY_ 阅读(128) 评论(0) 推荐(0) 编辑

2013年8月28日

摘要: 闲来无事,整理了一下C语言printf() 的格式控制语句。PS:详细来源于网络。printf的格式控制的完整格式:% - 0 m.n l或h 格式字符下面对组成格式说明的各项加以说明:①%:表示格式说明的起始符号,不可缺少。②-:有-表示左对齐输出,如省略表示右对齐输出。③0:有0表示指定空位填0,如省略表示指定空位不填。④m.n:m指域宽,即对应的输出项在输出设备上所占的字符数。N指精度。用于说明输出的实型数的小数位数。未指定n时,隐含的精度为n=6位。⑤l或h:l对整型指long型,对实型指double型。h用于将整型的格式字符修正为short型。格式字符格式字符用以指定输出项的数据类型 阅读全文
posted @ 2013-08-28 12:59 CY_ 阅读(373) 评论(0) 推荐(0) 编辑

2013年8月16日

摘要: 十进制与八进制的转换(栈和队列)Description对于输入的任意一个非负十进制整数,利用栈打印输出与其等值的八进制数。Input111Output157Sample Input148Sample Output224思想很简单,n除8取余,利用栈先进后出的特点成功实现10进制到8进制的转换代码:#include #includeusing namespace std;int main(){ stack s; int n; while(cin>>n&&n>0) { stack s; while(n>0) { ... 阅读全文
posted @ 2013-08-16 15:47 CY_ 阅读(326) 评论(0) 推荐(0) 编辑

2013年8月15日

摘要: Problem Description有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。其中,蜂房的结构如下所示。Input输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0b = a—>b-1 +a—>b-2 = a—>b-1-1 + a—>b-1-2 + a—>b-2-1 + b-2-2……最终是到a—>a+1 和a—>a+2然后就是转化成递推了由于a,b取值均在(1,50)之间,所以中间数据可以用一个含有50个元素的数组表示a[50];a[0] = 阅读全文
posted @ 2013-08-15 15:26 CY_ 阅读(168) 评论(0) 推荐(0) 编辑

2013年8月10日

摘要: Problem A: WERTYUDescriptionA common typing error is to place yourhands on the keyboard one row to the right of the correct position. Then ``Q'' is typed as ``W'' and ``J'' is typed as ``K'' and so on. Your task is to decode a message typed inthis manner.InputInput co 阅读全文
posted @ 2013-08-10 11:43 CY_ 阅读(215) 评论(0) 推荐(0) 编辑

2013年8月3日

摘要: #includeusing namespace std;int main(){ int n; while(cin>>n) { if((n+1)%4==3) cout=2).InputInput consists of a sequence of lines, each containing an integer n. (n > no 阅读全文
posted @ 2013-08-03 19:22 CY_ 阅读(135) 评论(0) 推荐(0) 编辑

2013年8月2日

摘要: DescriptionGraphical editors such as Photoshop allow us to alter bit-mapped images in the same way that text editors allow us to modify documents. Images are represented as an M x N array of pixels, where each pixel has a given color. Your task is to write a program which simulates a simple interact 阅读全文
posted @ 2013-08-02 11:37 CY_ 阅读(227) 评论(0) 推荐(0) 编辑