-
The Pascal language was developed by the Swiss Federal University of Technology Zurich. It was officially completed by Professor Niklaus Wirth in 1971 and named in honor of the French mathematician Pascal. It was modified in 1975 as the "Standard Pascal Language".
The Pascal language is developed on the basis of Algol60, which is a structured programming language; It is a system programming language that can be used to write applications or sequential system software. It was one of the most influential algorithmic languages of the 70s, with its powerful features and simple compiler.
At present, it has been extended into several versions. For example, Turbo Pascal
-
To put it bluntly, it's a programming thing, more powerful than Turbo Pascal, and the language is simpler (Pascal).
-
Free Pascal is a complete Win32 Pascal language compiler developed by an international organization, similar to Delphi, which can write Windows programs; Free Pascal is a 32-bit compiler that is a cross-platform compiler;
-
Simulation, the method is right, but there are too many mistakes.
What went wrong and how to fix it:
1. The big loop for i:=1 to n do is followed by a semicolon, so that the loop is empty, and the main program only does it once, removing the semicolon.
2. Fillchar is placed outside the loop, and it is put in the loop instead, and it must be restored every time.
3. Make a mistake when changing the handcuffs that have been turned on (true) to unopened (false), and the change is only once, so change the semicolon to else
4. The loop should be for a:=1 to y do to figure out the structure of the program and what each variable is stored, otherwise it will look messy and easy to confuse.
-
If the i-th and j-squares are the same color, then a triplet must be formed, and the value of the triplet is completely independent of the middle number.
So, let's use an array to store blocks of the same color with parity. Then the value is (numi+numj)*(i+j).
Now denote the subscript of the number of each group as a1 an, and the numa1 numan for the numa1 numa.
The answer is (numa1+numa2)*(a1+a2)+....If you do this, it's the algorithm of o(n 2).
However, if you look closely at the equation, you can get it by using the multiplication allocation rate.
The answer is equal to a1*(numa1*(n-1)+numa2+numa3+......numan)+
a2*(numa2*(n-1)+numa1+numa3+……numan)+…
an*(numa1*+numa2+
numa3+……numan*(n-1))
In this way, we can use sum to represent the sum of num from a1 to an, and sum2 to represent the sum of a1 to an, and the answer is sum*sum2+(n-2)*sum2
Note mod10007
-
The most popular method of finding prime numbers, known as the "screening method", or "the sieve of eratosthenes" by its inventor, is available in the encyclopedia
The principles on which it is based are:
In the following gif animation, you can also see the general steps of the sieve method: (directly delete 1).
How do you do it in Pascal? The way to do this is to construct an array of type boolean, and if prime[ i ]=true it means i is a prime number.
The details are as follows:
var i,j,n,sum:longint;
prime:array[2..1000000000]of boolean;
beginreadln(n);Enter a range to find prime numbers within 2 n;
fillchar(prime,sizeof(prime),true);Set all to true first;
for i:=2 to trunc(sqrt(n)) do
if prime[i] then if i is prime, assign the multiple of all i within n (not counting yourself) to false;
beginfor j:=2 to n div i do
prime[i*j]:=false;
end;for i:=2 to n do output;
if prime[i] then write(i,' ');
end.
-
Pascal is not familiar with C++ programs.
#include
#include
using namespace std;
int vis[1000];Array elements are all 0int main().
-
Here's what the popularization group is:
Note: The following Chinese content can not be typed.
-
The problem is in **ah???
Did you forget to send it again???
-
It's not uncommon to find this kind of untitled brain-dead problem!
-
In a nutshell:
The difference between read and readln is that read data without line break, while read ln read data with line break.
readlnAfter typing at the end of Free Pascal, you can type the data on the screen again, and you can view the data after running, instead of pressing enter to go back to the main interface.
The difference between write and writeln is that when the data is output, write is output without line breaking, that is, it can continue to output this line after the data is output, while writeln is a line break output, that is, when the next data is output, the next line of data is output.
-
The questioner said:"So why don't you get married? "
The least common multiple of 72 and 48 is 144,144 72 = 2 (hour) 144 48 = 3 (hour) 144 2 (2+3) =
It feels pretty much the same as the Intel Core 2 Duo E4400 >>>More
The 4 hidden bosses are a puppet that spawns every 1 week, and after you get all 4 items, you need a puppet of your profession.
Hello, computer blue screen, mainly: "memory error" or "software incompatibility" caused! >>>More
The answer is right. Here's why:
1 First of all, only people in this sentence will leave a deep impression, that is, "Chinese educators". But according to your sentence at the top, the one that left a deep impression was the public library of the "Centre National Pompidou". A public library is not a living thing, so how can it be impressive? >>>More