随笔分类 - 数学
摘要:正整数k的倒数1/k,写为10进制的小数如果为无限循环小数,则存在一个循环节,求<=n的数中,倒数循环节长度最长的那个数,假如存在多个最优的答案,输出所有答案中最大的那个数。 1/6= 0.1(6) 循环节长度为1 1/7= 0.(142857) 循环节长度为6 1/9= 0.(1) 循环节长度为1
阅读全文
摘要:http://codeforces.com/problemset/problem/963/A 不考虑正负的话,每两项之间之间公比为b/a,考虑正负,则把k段作为循环节,循环节育循环节之间公比为(b/a)^k,在把第一个k小节整体看作第一项,等比数列求和。 #include <iostream> #i
阅读全文
摘要:问题描述 小明先把硬币摆成了一个 n 行 m 列的矩阵。 随后,小明对每一个硬币分别进行一次 Q 操作。 对第x行第y列的硬币进行 Q 操作的定义:将所有第 i*x 行,第 j*y 列的硬币进行翻转。 其中i和j为任意使操作可行的正整数,行号和列号都是从1开始。 当小明对所有硬币都进行了一次 Q 操
阅读全文
摘要:Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only i
阅读全文
摘要:B. Pasha and Phone time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has recently bou
阅读全文
摘要:A - Biscuits Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement There are N bags of biscuits. The i-th bag contains Ai bisc
阅读全文
摘要:题目内容:找出输入数据中所有两两相乘的积为12!的对数。 输入描述:输入数据中含有一些整数n(1<=n<232)。 输出描述:输出所有两两相乘的积为12!的对数。 输入样例 1 10000 159667200 9696 38373635 1000000 479001600 3 1 479001600
阅读全文
摘要:http://codeforces.com/problemset/problem/230/B B. T-primes time limit per test 2 seconds memory limit per test 256 megabytes input standard input outp
阅读全文
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2723 Prime Number Definition An integer greater than one is called a prime number if its
阅读全文
摘要:A. Watchmen time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output A. Watchmen time limit per t
阅读全文
摘要:题目描述 Jesse是个数学迷,他最喜欢研究“哥德巴赫猜想”,因此他的计算机密码也都采用素数。 但一直用同一个密码是不安全的,所以他要经常更换他的密码。但他只允许自己的密码中出现某些数字,且密码的每一位都不相同。比如1 2 4,则有6种情况124 142 214 241 412 421。其中241
阅读全文
摘要:题目描述 Redraiment碰到了一个难题,需要请你来帮忙:给你两个整数,请你计算A × B。 输入 数据的第一行是整数T(1 ≤ T ≤ 20),代表测试数据的组数。 接着有T组数据,每组数据只有一行,包括两个正整数A和B。 但A和B非常大,Redraiment能保证这些数用long来保存一定会
阅读全文
摘要:放苹果 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。Input 第一行是测试数据的数目t(0 <= t <= 20)。以下每行均包含二个整数M和N,以空格分开。1<=M,N<=10。 Output 对输入的每组
阅读全文
摘要:A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacen
阅读全文
摘要:You will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ there. Surly, you may get many differen
阅读全文
摘要:题目描述 八皇后问题 是一个古老而著名的问题,是回溯算法的典型案例。 该问题是国际西洋棋棋手马克斯·贝瑟尔于1848年提出的,在8*8格的国际象棋上摆放八个皇后;使其不能互相攻击,即任意两个皇后都不能处于同一行、同一列或同一斜线上; 问有多少种摆法, 输出所有可能的解? #include<iostr
阅读全文
摘要:Description 众所周知,pigofzhou有许多妹子。有一天,pigofzhou得到了一根巧克力棒,他想把这根巧克力棒分给他的妹子们。具体地,这根巧克力棒长为 n,他想将这根巧克力棒折成 n 段长为 1 的巧克力棒,然后分给妹子们。 但是他妹子之一中的 15zhazhahe 有强迫症。若它
阅读全文

浙公网安备 33010602011771号