04 2012 档案

摘要:题就是看规律,比如 第1行 的九个数字的特征,第2~n+1行各个数字的特征,第n+2~2*n+2行各个数字,第2*n+3行的。即可以敲心中所想了。 1 #include<iostream> 2 using namespace std; 3 4 int main() 5 { 6 //freopen("output","w",stdout); 7 int n,len,i,j,k,x; 8 char ch[9]; 9 while(scanf("%d%s",&n,ch)!=EOF) 10 { 11 if(n==0& 阅读全文
posted @ 2012-04-18 19:17 南柯南 阅读(376) 评论(0) 推荐(0)
摘要:1 #include<iostream> 2 using namespace std; 3 4 int a[1000001]; 5 6 7 int main() 8 { 9 int n,m,max;10 __int64 i,k;11 int cnt ;12 13 for(k = 1; k <= 100000; k++)14 {15 cnt = 0;16 i = k;17 while(true)18 {19 cnt... 阅读全文
posted @ 2012-04-18 13:07 南柯南 阅读(177) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <math.h> 3 4 void main() 5 { 6 int a[21]; 7 int n,i; 8 double p,sum; 9 a[0] = 0; a[1] = 1;10 for(i = 2; i <= 20; i ++)11 a[i] = a[i-1] + a[i-2];12 while(scanf("%d",&n)!= EOF)13 {14 if(n <= 20)15 {16 pri... 阅读全文
posted @ 2012-04-17 18:14 南柯南 阅读(148) 评论(0) 推荐(0)
摘要:一看此题,顿觉茫然,搜得思路,方知原来可以这样。最是累完了,错一点,就得那个望眼欲穿的改哇!首先须知:小数有 有限和无限之分,其中无限小数中,又分无限循环和无限不循环小数,能用分数表示的当然只有有限小数和无限循环小数。有限小数就简单了,无论多少只要小数点后面的 除以 10的n次方就行了,约分一下就完事了。对于无限循环小数分两种,这里举例说明:⑴ 把0.4747……化成分数。0.4747……×100=47.4747…… 0.4747……×100-0.4747……=47.4747……-0.4747…… 注:因为是无限小数,所以小数点后趋向于无穷远处的 相减极限为零了 (100- 阅读全文
posted @ 2012-04-14 16:43 南柯南 阅读(250) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1271仿照别人写的,此代码看了良久,最终仍然不敢说大彻大悟,数学方法用的太绝了。大致思想为:首先假设X的第k位拿走,然后加上去掉第k位后的X',其和正好等于N。这样的话 我们可以把X 分解成:X= a+b * 10^k +c * 10^( k+1 ); 这里特别强调一下, a代表的是比第k位后面的低位数子,可能是多位,b仅仅代表一个数值,即你选择拿开的那位数,c代表的是比k位高的高位数字,例如:12345 您想拿走3的话 这时候a=45,c=12,b=3; 然后拿走之后就会组合成另一个数:X' 阅读全文
posted @ 2012-04-14 16:43 南柯南 阅读(119) 评论(0) 推荐(0)
摘要:http://acm.ccucomp.cn/acmhome/problemdetail.do?&method=showdetail&id=1113 1 #include<iostream> 2 #include<algorithm> 3 4 using namespace std; 5 6 int n,sum,len; 7 int count; 8 int sticks[65]; 9 int cmp(const void *a, const void *b) // 比较函数 10 { 11 return *(int *)b - *(int *)a; 12 阅读全文
posted @ 2012-04-12 20:31 南柯南 阅读(189) 评论(0) 推荐(0)
摘要:杭电1027 IgnatiusAndhe Princess II是一个全排列,解题使用到数学知识 字典序,详细解释例子在我的 文件 里的《字典序》,可以直接用调用函数库里的next_permutation(),其头文件是<algorithm>代码如下:#include<iostream>using namespace std; #include<algorithm>int main() { int arr[1001]; int n,m,i; while(scanf("%d%d",&n,&m) != EOF) { for(i 阅读全文
posted @ 2012-04-07 19:58 南柯南 阅读(542) 评论(2) 推荐(0)