随笔分类 -  数学公式&几何

摘要:本题的意思就是给你一个不能被2或5整除的数,输出这个数的倍数的最小位数,这个倍数全部由1组成显然,如果模拟计算的话需要高精度,数据多了可能会超时,还是得用数学方法111......111(n个1)=111......11(n-1个1)*10+1由于找的是它的倍数,所以在扩展的过程中为了防止数据类型的溢出可以取余运算while(tmp) { tmp=tmp*10+1; ++cnt; tmp%=n; } OnesTime Limit: 1000MSMemory Limit: 65536KDescriptionGiven any integer 0 <= n <= 10000 not.. 阅读全文

posted @ 2011-04-28 17:08 yming0221 阅读(171) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=3199/* Author : yan * Question : POJ 3199 Uncle Jack * Date && Time : Friday, February 18 2011 01:45 PM * Compiler : gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3*/#include<stdio.h>#define MAX 30char mul1[MAX];char ans[2*MAX];void multiply(char *a,char *b,char *c){ int i, 阅读全文

posted @ 2011-02-18 14:07 yming0221 阅读(213) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=2606http://poj.org/problem?id=1118这里是O(n^3)实现 水过!Lining UpTime Limit:2000MSMemory Limit:32768KDescription"How am I ever going to solve this problem?" said the pilot.Indeed, the pilot was not facing an easy task. She had to drop packages at specific points scattere 阅读全文

posted @ 2011-02-12 19:53 yming0221 阅读(191) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=3090Visible Lattice PointsTime Limit:1000MSMemory Limit:65536KDescriptionA lattice point (x,y) in the first quadrant (xandyare integers greater than or equal to 0), other than the origin, is visible from the origin if the line from (0, 0) to (x,y) does not pass through any 阅读全文

posted @ 2011-02-07 20:02 yming0221 阅读(112) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=2249Binomial ShowdownTime Limit:1000MSMemory Limit:65536KDescriptionIn how many ways can you choose k elements out of n elements, not taking order into account?Write a program to compute this number.InputThe input will contain one or more test cases.Each test case consists 阅读全文

posted @ 2011-02-03 18:53 yming0221 阅读(162) 评论(0) 推荐(0)

摘要:http://poj.org/problem?id=2407RelativesTime Limit:1000MSMemory Limit:65536KTotal Submissions:6610Accepted:2992DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 阅读全文

posted @ 2011-01-29 14:32 yming0221 阅读(153) 评论(0) 推荐(0)

导航