给你两个数字p,a。如果p是素数,并且ap mod p = a,输出“yes”,否则输出“no”。 很简单的板子题。核心算法是幂取模(算法详见《算法竞赛入门经典》315页)。 幂取模板子: 1 int pow_mod(int a,int n,int m) 2 { 3 if(n==0) return ...
分类:
其他好文 时间:
2019-04-03 23:43:42
阅读次数:
195
Lucky Numbers CodeForces - 630C 小希称只含7和8的数是幸运数,那么不超过n位的幸运数有多少个? Input 一个整数 n (1?≤?n?≤?55) Output 输出幸运数的数量 Example Input 2 Input 2 Output 6 sol:这和0,1有个 ...
分类:
其他好文 时间:
2019-04-03 20:39:14
阅读次数:
137
题目要求 Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1 ...
分类:
移动开发 时间:
2019-04-03 09:36:10
阅读次数:
145
Problem 5 Problem 5 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest po ...
分类:
其他好文 时间:
2019-04-02 17:06:58
阅读次数:
104
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo ...
分类:
其他好文 时间:
2019-04-02 16:51:36
阅读次数:
145
确界原理 supremum and infimum principle 戴德金定理 Dedekind theorem http://www.math.ubc.ca/~cass/courses/m446-05b/dedekind-book.pdf#page=15 continulity and irr ...
分类:
其他好文 时间:
2019-04-02 09:20:24
阅读次数:
190
#1.编写一系列条件测试;将每个测试以及结果打印出来 car = '宝马' if car == "宝马": print("预测正确") print(car) else: print("预测错误") boy_age = 23 girl_age = 20 if boy_age numbers[1]: p... ...
分类:
编程语言 时间:
2019-04-01 11:44:05
阅读次数:
216
Algorithm Leetcode 2. Add Two Numbers You are given two non empty linked lists representing two non negative integers. The digits are stored in revers ...
分类:
其他好文 时间:
2019-03-31 23:16:42
阅读次数:
176
使用l,r指针游动。 然后使用记录游动过程中的最大值。 我离散化了一下。 #include<stdio.h> #include<string.h> #include<algorithm> #include<iostream> #include<vector> #include<map> using ...
分类:
其他好文 时间:
2019-03-31 09:48:38
阅读次数:
164
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function ...
分类:
其他好文 时间:
2019-03-30 17:22:24
阅读次数:
163