In c++, find the largest 10 prime numbers within 100,

... c++, and find the maximum 10 prime numbers within 100. And output the 10 largest prime numbers in 4 rows. Then sum the 10 prime numbers Idea: to determine whether a number m is a prime number, you need to divide all the numbers of 2~m-1 by m. However, the factors of m appear in pairs,...


BZOJ5218[Lydsy2017 provincial team ten consecutive test] Sister city

... 友好城市 Description There are n cities in Byteland, numbered 1 to n, and these cities are connected by m one-way roads. For two different cities a and b, if a can reach b directly or indirectly through these one-way roads, and b can also reach a like this, then they are considered to be a...


Alternative repulsion and Euler function clever application (HDU--5514)

... There are mm stones lying on a circle, and nn frogs are jumping over them. The stones are numbered from 00 to m−1m−1 and the frogs are numbered from 11 to nn. The ii-th frog can jump over exactly aiai stones in a single step, which means from stone j mod mj mod m to stone (j+ai) mod m(j...


Sword refers to offer—(1) Assignment operator function

... Topic description: The following is the declaration of type CMyString, please add an assignment operator function for this type. Implement as follows: is my solution, suitable for C++ junior programmer // // Created by yanpan on 2018/9/30. // #if 1 #include <iostream> Using...


HDU 1232 - unblock the project and check the entry

... 题意: Given your n villages and m roads, each road connects two villages, and ask for the minimum number of roads to make any two villages They can reach each other (direct and indirect). 思维: This is a set of classic entry questions, you can see how many connected components in these...


Straight Master Gym

... A straight is a poker hand containing five cards of sequential rank, not necessarily to be the same suit. For example, a hand containing 7 club, 6 spade, 5 spade, 4 heart and 3 diamond forms a straight. In this problem, we extend the definition of a straight to allow 3 to 5 cards of...


3953 Intervals

... @题 #define debug(a,n) for(int i=0;i<n;++i)cout<<a[i]<<' ';cout<<endl; #define FRER() freopen("i.txt","r",stdin) #include<bits/stdc++.h> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; const int N=50000+10; struct node { int l,r,i; bool...


51nod 1076 2 disjoint paths

... 思维: If you look carefully, you should be able to see that if there are two paths between the two points that you do not want to intersect, then the two points are definitely on a Unicom branch, and these two The points are on the ring, so it is actually whether the two points after the...


DS-007 Sequence Table - Find the median of two sequences

... Topic: An ascending sequence S of length L (L ≥ 1), the number in the [L/2] position is called S median. For example, if the column S1 = (11, 13, 15, 17, 19), the median in S1 is 15. The median of the two sequences is the median of the ascending sequence containing all of their elements...


Fibonacci said that 51Nod

... indecision first hit the table and found that f[i] regularly appeared in the Fibonacci number hierarchy as follows 1 1 2 1 3 1 2 4 1 2 2 5 1 2 2 2 3 6 1 2 2 2 3 2 3 3 7 1 2 2 2 3 2 3 3 2 3 3 3 0 前n item and can preprocess part because of Fibonacci The number of deeds is close to the...