CY_

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

2014年4月13日

摘要: 题目描述We know thatIvan gives Saya three problems to solve (Problem F), and this is the firstproblem.“We need a programmer to help us for some projects. If you show us that youor one of your friends is able to program, you can pass the first hurdle.I will give you a problem to solve. Since this is the 阅读全文
posted @ 2014-04-13 17:34 CY_ 阅读(218) 评论(0) 推荐(0) 编辑

2014年4月11日

摘要: Problem Description要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973)= 1)。Input数据的第一行是一个T,表示有T组数据。每组数据有两个数n(0 A = B*x;n = A % 9973 = A - A / 9973 * 9973 := B*x - A/9973*9973= n可以 令 y = A / 9973; 则 B * x + y * 9973 = n; 因为 gcd(9973,B) = 1,所以不能用exgcd(B,9973,x,y);B * x1 + 9973 * y1 = 1; -.. 阅读全文
posted @ 2014-04-11 15:41 CY_ 阅读(126) 评论(0) 推荐(0) 编辑

摘要: Problem Description我知道部分同学最近在看中国剩余定理,就这个定理本身,还是比较简单的:假设m1,m2,…,mk两两互素,则下面同余方程组:x≡a1(mod m1)x≡a2(mod m2)…x≡ak(mod mk)在0#includeusing namespace std;__int64 gcd(__int64 a,__int64 b)//求最大公约数{ __int64 temp; if(a>n>>a&&n&&a) { //memset(a,0,sizeof(a)); ans = 1; cin>>x; ... 阅读全文
posted @ 2014-04-11 13:23 CY_ 阅读(154) 评论(0) 推荐(0) 编辑

2014年4月9日

摘要: Problem DescriptionThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.InputInput will consist of multiple problem instances. The first line of the input will conta 阅读全文
posted @ 2014-04-09 19:38 CY_ 阅读(123) 评论(0) 推荐(0) 编辑

2014年4月7日

摘要: 虽然已经学了一年多了,但是看到《程序员的数学》第二章后感想又有很多,就写个读后 小感吧!1.带条件的逻辑与(&&)逻辑与(&&)定义 : (表格形式)可以看出:1). A 为 true 时 , B 的值就为 A && B 的值。2). A 为 false 时,不用看 B ,A && B 的值为 false 。3). A 为 undefined 时,计算机不进行任何处理,因此不用 看 A 和 B ,A && B 的值 为 undefined。代码解释:代码块1if(A && B){ ……}代码块 2i 阅读全文
posted @ 2014-04-07 20:56 CY_ 阅读(229) 评论(0) 推荐(0) 编辑

2014年4月4日

摘要: Problem DescriptionInmany applications very large integers numbers are required. Some of theseapplications are using keys for secure transmission of data, encryption, etc.In this problem you are given a number, you have to determine the number ofdigits in the factorial of the number.InputInputconsis 阅读全文
posted @ 2014-04-04 20:59 CY_ 阅读(144) 评论(0) 推荐(0) 编辑

2014年3月28日

摘要: 继续数论。。Problem DescriptionWhereIsHeroFrom:Zty,what are you doing ?Zty:Iwant to calculate N!......WhereIsHeroFrom:Soeasy! How big N is ?Zty:140时,输出全部为 0。。。***********************************************************/#include#includeusing namespace std;int num[42];void cal(){ num[0] = 1,num[1] = 1; for( 阅读全文
posted @ 2014-03-28 21:22 CY_ 阅读(137) 评论(0) 推荐(0) 编辑

摘要: Problem DescriptionWritea program to read in a list of integers and determine whether or not eachnumber is prime. A number, n, is prime if its only divisors are 1 and n. Forthis problem, the numbers 1 and 2 are not considered primes.InputEachinput line contains a single integer. The list of integers 阅读全文
posted @ 2014-03-28 19:29 CY_ 阅读(275) 评论(0) 推荐(0) 编辑

2014年3月26日

摘要: Counting TrianglesProblem DescriptionGiven an equilateral triangle with n thelength of its side, program to count how many triangles in it.InputThe length n (n using namespace std;int num[1000];void cal(){ num[1] = 1;int i; for(i = 2;i>n&&n) { sum = n*(n+1)*(n+2)/6; n-=1; ... 阅读全文
posted @ 2014-03-26 20:23 CY_ 阅读(251) 评论(0) 推荐(0) 编辑

2014年3月23日

摘要: 转载自新浪博客,,http://blog.sina.com.cn/s/blog_71ded6bf0100tuya.html基础题:1000、1001、1004、1005、1008、1012、1013、1014、1017、1019、1021、1028、1029、1032、1037、1040、1048、1056、1058、1061、1070、1076、1089、1090、1091、1092、1093、1094、1095、1096、1097、1098、1106、1108、1157、1163、1164、1170、1194、1196、1197、1201、1202、1205、1219、1234、1235、 阅读全文
posted @ 2014-03-23 18:27 CY_ 阅读(196) 评论(0) 推荐(0) 编辑