SGU 169 numbers 数学】的更多相关文章

169.Numbers Let us call P(n) - the product of all digits of number n (in decimal notation). For example, P(1243)=1*2*4*3=24; P(198501243)=0. Let us call n to be a good number, if (p(n)<>0) and (n mod P(n)=0). Let us call n to be a perfect number, if…
题意:n和n+1同时被数位乘积整除的k位数个数. 假如a是237,b是238.由于个位以前的数一样.那么对于2,如果a%2==0,b%2就!=0,如果a%3==0,b%3就!=0.因此个位以前的数只能是1.再列举个位的情况. #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> #include <ioman…
题意:中文题,直接忽略... 析:先说说我的思路,我一看这个题第一感觉就是要找规律,要是挨着算,猴年马月都跑不完,更何况时间限制是0.25s,怎么找规律呢,我算了一下前10位,分别是8,1,1,3,1,1,4,1,1,3,然后我就觉得应该是113114循环再加一第一位是8,果然AC了. 然后结束后我看看了题解好像是算出来的,因为数很大又不是高精度,肯定是要找规律了,假设n有k位,分别从右往左a1,a2...ak,首先a1(也就是个位)肯定不是9(因为如果是9,那么n+1就有0了),所以呢n+1各…
Colossal Fibonacci Numbers 想先说下最近的状态吧,已经考完试了,这个暑假也应该是最后刷题的暑假了,打完今年acm就应该会退了,但是还什么都不会呢? +_+ 所以这个暑假,一定要竭尽全力地去刷题,当然,也是能好好刷题的最后时间了. [题目链接]Colossal Fibonacci Numbers [题目类型]数学 &题意: 求Fi(f(a^b)%n) Fi()是斐波那契 &题解: 注意:unsigned时 要把%d全换成%u 数学大法好. 首先你要能看出来这是有循环…
Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'Ro, Sham, Bo', and a host of other names) in order to make arbitrary decisions such as who gets…
2019 杭电多校 8 1003 题目链接:HDU 6659 比赛链接:2019 Multi-University Training Contest 8 Problem Description Acesrc is a famous mathematician at Nanjing University second to none. Playing with interesting numbers is his favorite. Today, he finds a manuscript whe…
Consider this sequence {1, 2, 3, . . . , N}, as a initial sequence of first N natural numbers. You canearrange this sequence in many ways. There will be N! different arrangements. You have to calculatethe number of arrangement of first N natural numbers…
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the name “anna” is a palindrome. Numbers can also be palindromes (e.g. 151 or 753357). Additionallynumbers can of course be ordered in size. The first few…
题意翻译 给你一串数列a.对于一个质数p,定义函数f(p)=a数列中能被p整除的数的个数.给出m组询问l,r,询问[l,r]区间内所有素数p的f(p)之和. 题目描述 Recently, the bear started studying data structures and faced the following problem. You are given a sequence of integers x1,x2,...,xn x_{1},x_{2},...,x_{n} x1​,x2​,.…
一.题目大意 本题要求写出前1500个仅能被2,3,5整除的数. 二.题解 最初的想法是从1开始检验该数是否只能被2,3,5整除,方法是这样的,对于一个数,如果它能被2整除,就除以2,如果它能被3整除,就除以3,如果它能被5整除,就除以5,直到不能被2,3,5整除,看结果是不是1,如果是1就满足条件,否则不满足条件.但是第1500个数大约近10亿,显然是1s内不可以完成的. 然后仔细分析发现:满足条件的数是2^x*3^y*5^z,可以转换为这样的定义,定义一个集合,该集合中有元素1,如果x在集合…