100% found this document useful (7 votes)
35 views

(Ebook) Basic Exercises for Competitive Programming - Python by Jan Pol ISBN 9781005034474, 1005034478 All Chapters Instant Download

The document provides a collection of Python programming exercises aimed at competitive programming, including solutions and testing methods. Each exercise includes a problem statement, example input/output, and a Python code solution. The exercises cover various topics such as string manipulation, number sequences, and array modifications.

Uploaded by

tatiantiffny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (7 votes)
35 views

(Ebook) Basic Exercises for Competitive Programming - Python by Jan Pol ISBN 9781005034474, 1005034478 All Chapters Instant Download

The document provides a collection of Python programming exercises aimed at competitive programming, including solutions and testing methods. Each exercise includes a problem statement, example input/output, and a Python code solution. The exercises cover various topics such as string manipulation, number sequences, and array modifications.

Uploaded by

tatiantiffny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Download Full Version ebook - Visit ebooknice.

com

(Ebook) Basic Exercises for Competitive


Programming - Python by Jan Pol ISBN
9781005034474, 1005034478

https://ebooknice.com/product/basic-exercises-for-
competitive-programming-python-55854484

Click the button below to download

DOWLOAD EBOOK

Discover More Ebook - Explore Now at ebooknice.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Start reading on any device today!

(Ebook) Python Advanced Programming: The Guide to Learn


Python Programming. Reference with Exercises and Samples
About Dynamical Programming, Multithreading,
Multiprocessing, Debugging, Testing and More by Marcus
https://ebooknice.com/product/python-advanced-programming-the-guide-
Richards
to-learn-python-programming-reference-with-exercises-and-samples-
about-dynamical-programming-multithreading-multiprocessing-debugging-
testing-and-more-56236028
ebooknice.com

(Ebook) Python Programming For Beginners: Python Mastery


in 7 Days: Top-Secret Coding Tips with Hands-On Exercises
for Your Dream Job by Oswald Thornton ISBN B0CKRWS4NJ
https://ebooknice.com/product/python-programming-for-beginners-python-
mastery-in-7-days-top-secret-coding-tips-with-hands-on-exercises-for-
your-dream-job-55556426
ebooknice.com

(Ebook) Parallel Programming with Python by Jan Palach


ISBN 9781783288397, 1783288396

https://ebooknice.com/product/parallel-programming-with-python-5030408

ebooknice.com

(Ebook) Training Exercises for Competitive Tennis by Lutz


Steinhofel ISBN 9781841266558, 1841266558

https://ebooknice.com/product/training-exercises-for-competitive-
tennis-51402600

ebooknice.com
(Ebook) Basic Communication for Competitive Exams by Rony
Parvez

https://ebooknice.com/product/basic-communication-for-competitive-
exams-11408090

ebooknice.com

(Ebook) Programming Computer Vision with Python: Tools and


algorithms for analyzing images by Jan Erik Solem ISBN
9781449316549, 1449316549
https://ebooknice.com/product/programming-computer-vision-with-python-
tools-and-algorithms-for-analyzing-images-2623048

ebooknice.com

(Ebook) Python Programming for Beginners by Knowles, Chad

https://ebooknice.com/product/python-programming-for-
beginners-49556274

ebooknice.com

(Ebook) Competitive Programming in Python: 128 Algorithms


to Develop your Coding Skills by Christoph Dürr, Jill-Jênn
Vie ISBN 9781108591928, 9781108716826, 1108591922,
1108716822
https://ebooknice.com/product/competitive-programming-in-
python-128-algorithms-to-develop-your-coding-skills-22000366

ebooknice.com

(Ebook) Basic Vocabulary for Competitive Examinations by


Edgar Thorpe, Showick Thorpe, ISBN 9789332508101,
9789332520370, 9332508100, 9332520372
https://ebooknice.com/product/basic-vocabulary-for-competitive-
examinations-10879900

ebooknice.com
The following book shows a compilation of more than 20
basic exercises for competitive programming, all of them
are written in Python. In addition, desktop tests are added
to observe the operation of each algorithm.
Hoping you can take knowledge of the pages of this book,
my best wishes.
Jan Pol
Exercise 1
Write a program that reads a string S, and prints that line
on the standard output in reverse, that is, flipped right-to-
left.
Input
The only input has a string S.
Output
Print the string in reverse

Example
Input
1 2 3 hello
Output
olleh 3 2 1
Solution
One way to easily solve this task is to use a loop to print the
characters from the last position to the first. This avoids the
need to save the reverse list, just print each character.
The code for the solution written in Python is shown below.
1 l = input()
2 i = len(l)
3 while i > 0:
4 i = i - 1
5 print(l[i], end='')
6 print()

Desktop Testing
Doing a desktop testing, it is observed how in each iteration
each character is added inversely.
Exercise 2
Given of input a positive integer n. If n is even, the
algorithm divides it by two, and if n is odd, the algorithm
multiplies it by three and adds one. The algorithm repeats
this, until n is one. For example, the sequence for n=5 is as
follows:
5→16→8→4→21
Your task is to simulate the execution of the algorithm for a
given value of n.

Input
The only input line contains an positive integer n.
Output
Print a line that contains all values of n separated with
spaces.

Example
Input
5
Output
5 16 8 4 21
Solution
To solve this task, a cycle is used to verify that the number
is not yet 1. Within the cycle it is checked if the number is
even, it is divided by two, otherwise the number is multiplied
by 3 and 1 is added to it. the number is printed, like this
until the number is 1.
The code for the solution written in Python is shown below.
1 n = int(input())
2 print(n, end= ' ')
3 while n > 1:
4 if n % 2 == 0:
5 n //= 2
6 else:
7 n = 3 * n + 1
8 print(n, end=' ')

Desktop Testing
Doing a desktop testing, it shows if the number is odd or
even and the operation is performed.
Exercise 3
Write a program that reads a list of non-negative numbers
from the standard input, with one number per line, and
prints a histogram corresponding to those numbers. In this
histogram, each number N is represented by a line of N
characters "#"
Input
The only line contains n non-negative integers.
Output
Print the histogram result.

Example
Input
10 15 7 9 1 3
Output
##########
###############
#######
#########
#
###
Solution
To solve this task, it is taken into account that a list of non-
negative integers will be received so that they are saved
using a “map” of integers for the input, removing the
spaces. Then '#' is printed as many times as the value of the
number.
The code for the solution written in Python is shown below.
1 arr = map(int, input().split())
2
3 for a in arr:
4 print('#' * a)

Desktop Testing
Doing a desktop testing, it is shown how in the next line of
each iteration as many '#' as the value of the number are
added.
Exercise 4
You are given all numbers between 1,2,…,n except one.
Your task is to find the missing number.

Input
The first input line contains an integer n.
The second line contains n−1 numbers. Each number is
distinct and between 1 and n (inclusive).
Output
Print the missing number.

Example
Input
10
2 8 10 6 5 1 3 7 4
Output
9
Solution
To solve this task, the integer n is saved. Then the integer
line is saved. A sum is initialized, each integer is added. At
the end, the Gauss sum formula is used: n * (n + 1) / 2.
The previously made sum is subtracte it to obtain the
missing number. This works because the Gauss sum gets
the real total sum based on the total of numbers, if the sum
of the provided numbers is subtracted, the result will show
the missing value to get the real total sum.
The code for the solution written in Python is shown below.
1 n = int(input())
2 arr = map(int, input().split())
3 s = 0
4
5 for a in arr:
6 s += a
7
8 print(n * (n + 1) // 2 - s)

Desktop Testing
Doing a desktop testing, it is shown how in each iteration
the respective number is added. At the end the operation is
printed.
The final result is:
10 * (10 + 1) // 2 – 46
10 * 11 // 2 – 46
110 // 2 – 46
55 – 46
Result: 9
Exercise 5
Given a sequence of integers A, a maximal identical
sequence is a sequence of adjacent identical values of
maximal length k. Write a program that reads an input
sequence A, with one or more numbers per line, and
outputs the value of the first (leftmost) maximal identical
sequence in A.
Input
The first input line contains an integer n.
The second line contains n integers.
Output
Print one integer: the length of the longest repetition

Example
Input
24622
Output
2
Solution
To solve this task, an efficient way to know which number is
the most repeated is to use variables that help us in the
process. In this case, 'k' is used to determine how much a
number is repeated, 'i' saves the previous index, 'j' saves
the current index and 'v' stores the number that is repeated
the most sequentially.
At the beginning of the cycle, the previous and current
values are compared, if they are different, the indices are
exchanged. The index 'j' increases and is compared if the
numbers that are repeated is greater than 'k', if so, 'v' takes
the value of the number and 'k' takes the value of how
much that number was repeated.
The code for the solution written in Python is shown below.
1 A = list(map(int, input().split()))
2
3 v = A[0]
4k = 1
5i = 0
6j = 1
7 while j < len(A):
8 if A[j] != A[i]:
9i = j
10 j += 1
11 if j - i > k:
12 v = A[i]
13 k = j - i
14
15 print(v)
Desktop Testing
Doing a desktop testing, it is observed how in each cycle
the previous number and the current number are compared,
as well as the increase or exchange in the indexes according
to whether the sequential number is different. When the
numbers compared are equal, the index 'j' increases more
than the 'i', when not, the indexes go hand in hand.
Below is the sequence of integers 'A' and the desk test.
Exercise 6
You are given a DNA sequence: a string consisting of
characters A, C, G, and T. Your task is to find the longest
repetition in the sequence. This is a maximum-length
substring containing only one type of character.
Input
The only input line contains a string of n characters.
Output
Print one integer: the length of the longest repetition.

Example
Input
ATTGCCCA
Output
3
Solution
To solve this task, the input string is taken, using the
variables 'ans' stores the response, 'count' counts the
repetitions and 'l' contains the character to compare. A loop
is used to go through each character in the string, if the
character is repeated, add the counter and replace 'ans'
with the maximum between 'count' and 'ans', otherwise 'l'
becomes the new character and the counter is reset.
The code for the solution written in Python is shown below.
1 s = input()
2 ans = 1
3 count = 0
4 l = 'A'
5 for cha in s:
6 if cha == l:
7 count += 1
8 if count > ans:
9 ans = count
10 else:
11 l = cha
12 count = 1
13 print(ans, end=' ')
Desktop Testing
Doing a desktop testing, it shows how each character of the
sequence is compared, each that is equal increases the
counter and the maximum between the response is verified,
when the values are not reset.
Exercise 7
Write a program that takes a number N (a positive integer)
in decimal notation from the console, and prints its value as
a roman numeral.
Input
The only input line has an integer n.
Output
Print the value as a roman numeral.

Example
Input
2021
Output
MMXXI
Solution
To solve this task, the predefined characters of the Roman
numerals are listed, separated by groups, from one to nine,
from ten to 90 and from 100 to 900, each one with the
number zero. It is checked if the quantity is greater than or
equal to 1000, if so, the symbol 'M' is added as many times
as thousands it contains. Then the hundreds are extracted
and replaced by their respective symbols, in the same way
the tens and units, printing the result at the end.
The code for the solution written in Python is shown below.
1 ten_zero = ['', 'I', 'II', 'III', 'IV', 'V', 'VI',
'VII', 'VIII', 'IX']
2 ten_one = ['', 'X', 'XX', 'XXX', 'XL', 'L', 'LX',
'LXX', 'LXXX', 'XC']
3 ten_two = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC',
'DCC', 'DCCC', 'CM']
4
5 n = int(input())
6
7 r = ''
8 while n >= 1000:
9 r += 'M'
10 n -= 1000
11
12 c = n // 100
13 r += ten_two[c]
14 n -= c*100
15
16 d = n // 10
17 r += ten_one[d]
18 n -= d*10
19
20 r += ten_zero[n]
21
22 print(r)

Desktop Testing
Doing a desktop testing, it is shown how each thousand is
subtracted from the quantity and the symbol 'M' is added, in
the same way the hundreds, tens and units are extracted to
obtain the result.
Exercise 8
You are given an array of n integers. You want to modify the
array so that it is increasing. Every element is at least as
large as the previous element.
On each move, you may increase the value of any element
by one. Your task is find the minimum number of moves
required.
Input
The first input line contains an integer n, the size of the
array.
Then, the second line contains n integers, the contents of
the array.
Output
Print the minimum number of moves.

Example
Input
5
21415
Output
4
Solution
To solve this task, we must find the least amount of
movements necessary to increase the values of an array so
that the list increases. After reading the input data, the
variables 'mx' are initialized, the maximum and 'ans' are
stored with a value of zero, each one of the data in the
array is traversed, the maximum is searched and the value
of the number is subtracted, the result is saved in response.
This works because it is looking for if the number before the
current one is greater, it obtains the difference between
current and previous, in other words it obtains the increase
that is needed so that both values are equal.
The code for the solution written in Python is shown below.
1 n = int(input())
2 arr = map(int, input().split())
3 mx = 0
4 ans = 0
5
6 for x in arr:
7 mx = max(x, mx)
8 ans += mx - x
9
10 print(ans)
Desktop Testing
Doing a desktop testing, it is shown how the maximum value
is obtained, at the moment in which the value of x
decreases, it obtains the necessary value to be equal to the
previous one.
Exercise 9
A ‘beautiful’ permutation is a permutation of integers
1,2,…,n, if there are no adjacent elements whose difference
is 1.
Given n, construct a beautiful permutation if such a
permutation exists. If there are no solutions, print “NO
SOLUTION”
Input
The only input line contains an integer n.
Output
Print a beautiful permutation of integers 1,2,…,n. If there
are several solutions, you may print any of them. If there
are no solutions, print "NO SOLUTION".

Example
Input
5
Output
24135
Solution
To solve this task, the difference between elements is
required to be different than 1. When n is equal to 1, 1 is
printed, if it is less than 4 there is no solution, in all other
cases, it will be enough to print 2 by 2 starting at 2 up to
the value of n + 1 and in another cycle the same strategy
but starting at 1.
The code for the solution written in Python is shown below.
1 n = int(input())
2 if n == 1:
3 print(1, end=' ')
4 elif n < 4:
5 print('NO SOLUTION')
6
7 else:
8 for i in range(2, n+1, 2):
9 print(i, end=' ')
10
11 for i in range(1, n+1, 2):
12 print(i, end=' ')
Desktop Testing
Doing a desktop testing, it is easy to observe that it is only
enough to print numbers from 2 to 2 with different start, in
this way it ensures that the difference between the numbers
is not 1.
Random documents with unrelated
content Scribd suggests to you:
'You have some decency still,' Carmagnola told him.
'Whilst you cannot lay claim even to that. God made you a fool,
and that's the end of the matter.'
'Take him away.'
Already it seemed they had their orders. They laid hands upon
him, and, submitting without further words, he suffered them to lead
him out.
As the door closed upon him, Stoffel exploded. He raged and
stormed. He pleaded, argued, and vituperated them, even the
Princess herself, for fools and dolts, and finally threatened to raise
the army against them, or at least to do his utmost with his Swiss to
prevent them from carrying out their evil intentions.
'Listen!' Carmagnola commanded sternly, and in the silence they
heard from the hall below a storm of angry outcries. 'That is the
voice of the army, answering you: the voice of those who were
maimed last night as a result of his betrayal. Saving yourself, there is
not a captain in the army, and saving your own Swiss, hardly a man
who is not this morning clamouring for Bellarion's death.'
'You are confessing that you published the matter even before
Bellarion was examined here! My God, you villain, you hell-kite, you
swaggering ape, who give a free rein to the base jealousy in which
you have ever held Bellarion. Your mean spite may drive you now to
the lengths of murder. But look to yourself thereafter. You'll lose your
empty head over this, Carmagnola!'
They silenced him and bore him out, whereafter they sat down to
seal Bellarion's fate.

CHAPTER XI

THE PLEDGE
Unanimously the captains voted for Bellarion's death. The only
dissentients were the Marquis and his sister. The latter was appalled
by the swiftness with which this thing had come upon them, and
shrank from being in any sense a party to the slaying of a man,
however guilty. Also not only was she touched by Bellarion's
forbearance in the matter of trial by battle against her brother, but his
conduct in that connection sowed in her mind the first real doubt of
his guilt. Urgently she pleaded that he should be sent for trial before
the Duke.
Carmagnola, in refusing, conveyed the impression of a great soul
wrestling with circumstances, a noble knight placing duty above
inclination. It was a part that well became his splendid person.
'Because you ask it, madonna, for one reason, because of the
imputations of malice against me for another, I would give years of
my life to wash my hands of him and send him to Duke Filippo Maria.
But out of other considerations, in which your own and your brother's
future are concerned, I dare not. Saving perhaps Stoffel and his
Swiss, the whole army demands his death. The matter has gone too
far.'
The captains one and all proved him right by their own present
insistence.
'Yet I do not believe him guilty,' the young Marquis startled them,
'and I will be no party to the death of an innocent man.'
'Would any of us?' Carmagnola asked him. 'Is there any room for
doubt? The letter ...'
'The letter,' the boy interrupted hotly, 'is, as Bellarion says, a trick
of my uncle's to remove the one enemy he fears.'
That touched Carmagnola's vanity with wounding effect. He
dissembled the hurt. But it served to strengthen his purpose.
'That vain boaster has seduced you with his argument, eh?'
'No; not with his argument, but with his conduct. He could have
challenged me to trial by combat, as he showed. What am I to stand
against him? A thing of straw. Yet he declined. Was that the action of
a trickster?'
'It was,' Carmagnola answered emphatically. 'It was a trick to win
you over. For he knew, as we all know, that a sovereign prince does
not lie under that law of chivalry. He knew that if he had demanded it,
you would have been within your right in appointing a deputy.'
'Why, then, did you not say so at the time?' the Princess asked
him.
'Because he did not press the matter. Oh, madonna, believe me
there is no man in Italy who less desires to have Bellarion's blood on
his hands than I.' He spoke sorrowfully, heavily. 'But my duty is clear,
and whether it were clear or not, I must be governed by the voice of
these captains, all of whom demand, and rightly, this double-dealing
traitor's death.'
Emphatically the captains confirmed him in the assertion, as
emphatically Gian Giacomo repeated that he would be no party to it.
'You are not required to be,' Carmagnola assured him. 'You may
stand aside, my lord, and allow justice to take its course.'
'Sirs,' the Princess appealed to them, 'let me implore you again, at
least to send him to the Duke. Let the responsibility of his death lie
with his master.'
Carmagnola rose. 'Madonna, what you ask would lead to a
mutiny. To-morrow either I send Bellarion's head to his ally in
Vercelli, or the men will be out of hand and there will be an end to
this campaign. Dismiss your doubts and your fears. His guilt is
crystal clear. You need but remember his avowed intention of raising
the siege, to see in whose interest he works.'
Heavy-eyed and heavy-hearted she sat, tormented by doubt now
that she was face to face with decision where hitherto no single
doubt had been.
'You never asked him what alternative he proposed,' she
reminded him.
'To what end? That glib dissembler would have fooled us with
fresh falsehoods.'
Belluno got to his feet. He had been manifesting impatience for
some moments. 'Have we leave to go, my lord? This matter is at an
end.'
Ugolino da Tenda followed his example. 'The men below are
growing noisier. It is time we pacified them with our decision.'
'Aye, in God's name.' Carmagnola waved them away, and himself
strode off from the table towards the hearth. He stirred the logs with
his boot and sent an explosion of sparks flying up the chimney. 'Bear
him word of our decision, Belluno. Bid him prepare for death. He
shall have until daybreak to-morrow to make his soul.'
'O God! If we should be wrong!' groaned the Princess.
The captains clanked out, and the door closed. Slowly
Carmagnola turned; reproachfully he regarded her.
'Have you no faith in me, Valeria? Should I do this thing if there
were any room for doubt?'
'You may be mistaken. You have been mistaken before,
remember.'
He did not like to remember it. 'And you? Have you been
mistaken all these years? Are you mistaken on the death of your
friend Count Spigno and what followed?'
'Ah! I was forgetting that,' she confessed.
'Remember it. And remember what he said at that table, which
may, after all, be the truth. That Count Spigno has risen from the
grave at last for vengeance.'
'Will you not send for this clown, at least?' cried Gian Giacomo.
'To what purpose now? What can he add to what we know? The
matter, Lord Marquis, is finished.'
And meanwhile Belluno was seeking Bellarion in the small
chamber in which they had confined him on the ground floor of the
castle.
With perfect composure Bellarion heard the words of doom. He
did not believe them. This sudden thing was too monstrously
impossible. It was incredible the gods should have raised him so
swiftly to his pinnacle of fame, merely to cast him down again for
their amusement. They might make sport with him, but they would
hardly carry it to the lengths of quenching his life.
His only answer now was to proffer his pinioned wrists, and beg
that the cord might be cut. Belluno shook his head to that in silence.
Bellarion grew indignant.
'What purpose does it serve beyond a cruelty? The window is
barred; the door is strong, and there is probably a guard beyond it. I
could not escape if I would.'
'You'll be less likely to attempt it with bound wrists.'
'I'll pass you my parole of honour to remain a prisoner.'
'You are convicted of treachery, and you know as well as I do that
the parole of a convicted traitor is never taken.'
'Go to the devil, then,' said Bellarion, which so angered Belluno
that he called in the guard, and ordered them to bind Bellarion's
ankles as well.
So trussed that he could move only by hops, and then at the risk
of falling, they left him. He sat down on one of the two stools which
with a table made up all the furniture of that bare chill place. He
wagged his head and even smiled over the thought of Belluno's
refusal to accept his parole, or rather over the thought that in offering
it he had no notion of keeping it.
'I'd break more than my pledged word to get out of this,' said he to
himself. 'And only an idiot would blame me.'
He looked round the bare stone walls, and lastly at the window.
He rose, and hopped over to it. Leaning on the sill, which was at the
height of his breast, he looked out. It opened upon the inner court,
he found, so that wherever escape might lie, it lay not that way. The
sill upon the rough edge of which he leaned was of granite. He
studied it awhile attentively.
'The fools!' he said, and hopped back to his stool, where he gave
himself up to quiet meditation until they brought him a hunch of
bread and a jug of wine.
To the man-at-arms who acted as gaoler, he held out his pinioned
wrists. 'How am I to eat and drink?' he asked.
'You'll make shift as best you can.'
He made shift, and by using his two hands as one contrived to eat
and to drink. After that he spent some time at the sill, patiently
drawing his wrists backwards and forwards along the edge of it, with
long rests between whiles to restore the blood which had flowed out
of upheld arms. It was wearying toil, and kept him fully engaged for
some hours.
Towards dusk he set up a shouting which at last brought the
guard into his prison.
'You're in haste to die, my lord,' the fellow insolently mocked him.
'But quiet you. The stranglers are bidden for daybreak.'
'And I am to perish like a dog?' Bellarion furiously asked him. With
pinioned wrists and ankles he sat there by his table. 'Am I never to
have a priest to shrive me?'
'Oh! Ah! A priest?' The fellow went out. He went in quest of
Carmagnola. But Carmagnola was absent, marshalling his men
against a threatened attempt by Stoffel and the Swiss to rescue
Bellarion. The captains were away about the same business, and
there remained only the Princess and her brother.
'Messer Bellarion is asking for a priest,' he told them.
'Has none been sent to him?' cried Gian Giacomo, scandalised.
'He'd not be sent until an hour before the stranglers.'
Valeria shuddered, and sat numbed with horror. Gian Giacomo
swore under his breath. 'In God's name, let the poor fellow have a
priest at once. Let one be sent for from Quinto.'
It would be an hour later when a preaching friar from the convent
of Saint Dominic was ushered into Bellarion's prison, a tall, frail man
in a long black mantle over his white habit.
The guard placed a lantern on the table, glanced compassionately
at the prisoner, who sat there as he had earlier seen him with
pinioned wrists and ankles. But something had happened to the
cords meanwhile, for no sooner had the guard passed out and
closed the door than Bellarion stood up and his bonds fell from him
like cobwebs, startling the good monk who came to shrive him.
Infinitely more startled was the good monk to find himself suddenly
seized by the throat in a pair of strong, nervous hands whose
thumbs were so pressed into his windpipe that he could neither cry
out nor breathe. He writhed in that unrelenting grip, until a fierce
whisper quieted him.
'Be still if you would hope to live. If you undertake to make no
sound, tap your foot twice upon the ground, and I'll release you.'
Frantically the foot was tapped.
'But remember that at the first outcry, I shall kill you without
mercy.'
He removed his hands, and the priest almost choked himself in
his sudden greed of air.
'Why? Why do you assault me?' he gasped. 'I come to comfort
and ...'
'I know why you come better than you do, brother. You think you
bring me the promise of eternal life. All that I require from you at
present is the promise of temporal existence. So we'll leave the
shriving for something more urgent.'
It would be a half-hour later, when cowled as he had entered the
tall, the bowed figure of the priest emerged again from the room,
bearing the lantern.
'I've brought the light, my son,' he said almost in a whisper. 'Your
prisoner desires to be alone in the dark with his thoughts.'
The man-at-arms took the lantern in one hand, whilst with the
other he was driving home the bolt. Suddenly he swung the lantern
to the level of the cowl. This priest did not seem quite the same as
the one who had entered. The next moment, on his back, his throat
gripped by the vigorous man who knelt upon him, the guard knew
that his suspicions had been well-founded. Another moment and he
knew nothing. For the hands that held him had hammered his head
against the stone floor until consciousness was blotted out.
Bellarion extinguished the lantern, pushed the unconscious man-
at-arms into the deepest shadow of that dimly lighted hall, adjusted
his mantle and cowl, and went quickly out.
The soldiers in the courtyard saw in that cowled figure only the
monk who had gone to shrive Bellarion. The postern was opened for
him, and with a murmured 'Pax vobiscum,' he passed out across the
lesser bridge, and gained the open. Thereafter, under cover of the
night, he went at speed, the monkish gown tucked high, for he knew
not how soon the sentinel he had stunned might recover to give the
alarm. In his haste he almost stumbled upon a strong picket, and in
fleeing from that he was within an ace of blundering into another.
Thereafter he proceeded with more caution over ground that was
everywhere held by groups of soldiers, posted by Carmagnola
against any attempt on the part of the Swiss.
As a result it was not until an hour or so before midnight that he
came at last to Stoffel's quarters, away to the south of Vercelli, and
found there everything in ferment. He was stopped by a party of men
of Uri, to whom at once he made himself known, and even whilst
they conducted him to their captain, the news of his presence ran
like fire through the Swiss encampment.
Stoffel, who was in full armour when Bellarion entered his tent,
gasped his questioning amazement whilst Bellarion threw off his
mantle and white woollen habit, and stood forth in his own proper
person and garments.
'We were on the point of coming for you,' Stoffel told him.
'A fool's errand, Werner. What could you have done against three
thousand men, who are ready and expecting you?' But he spoke
with a warm hand firmly gripping Stoffel's shoulders and a heart
warmed, indeed, by this proof of trust and loyalty.
'Something we might have done. There was a will on our side that
must be lacking on the other.'
'And the walls of Quinto? You'd have beaten your heads in vain
against them, even had you succeeded in reaching them. It's as
lucky for you as for me that I've saved you this trouble.'
'And what now?' Stoffel asked him.
'Give the order to break camp at once. We march to Mortara to
rejoin the Company of the White Dog from which I should never have
separated. We'll show Carmagnola and those Montferrine princes
what Bellarion can do.'
Meanwhile they already had some notion of it. The alarm at his
escape had spread through Quinto; and Carmagnola had been
fetched from the lines to be informed of it in detail by a half-naked
priest and a man-at-arms with a bandaged head. It had taken some
time to find him. It took more for him to resolve what should be done.
At last, however, he decided that Bellarion would have fled to Stoffel;
so he assembled his captains, and with the whole army marched on
the Swiss encampment. But he came too late. At the last the Swiss
had not waited to strike their camp, realising the danger of delay, but
had departed leaving it standing.
Back to Quinto and the agitated Princess went Carmagnola with
the news of failure. He found her waiting alone in the armoury,
huddled in a great chair by the fire.
'That he will have gone to his own condotta at Mortara is certain,'
he declared. 'But without knowing which road he took, how could I
follow in the dark? And to follow meant fulfilling that traitor's intention
of raising this siege.'
He raged and swore, striding to and fro there in his wrath, bitterly
upbraiding himself for not having taken better precautions knowing
with what a trickster he had to deal, damning the priest and the
sentry and the fools in the courtyard who had allowed Bellarion to
walk undetected through their ranks.
She watched him, and found him less admirable than hitherto in
the wildness of his ravings. Unwillingly almost her mind contrasted
his behaviour under stress with the calm she had observed in
Bellarion. She fetched a weary sigh. If only Bellarion had been true
and loyal, what a champion would he not have been.
'Raging will not help you, Carmagnola,' she said at last, the least
asperity in her tone.
It brought him, pained, to a halt before her. 'And whence,
madonna, is my rage? Have I lost anything? Do I strive here for
personal ends? Ha! I rage at the thought of the difficulties that will
rise up for you.'
'For me?'
'Can you doubt what will follow? Do you think that all that we have
lost to-night is Bellarion, with perhaps his Swiss? The men at
Mortara are mostly of his own company, the Company of the Dog. A
well-named company, as God lives! And those who are not serve
under captains who are loyal to him and who, knowing nothing of his
discovered treachery here, will be beguiled by that seducer. In
strength he will be our superior, with close upon four thousand men.'
She looked up at him in alarm. 'You are suggesting that we shall
have him coming against us!'
'What else? Do we not know enough already of his aims? By all
the Saints! Things could not have fallen out better to give him the
pretext that he needed.' He was raging again. 'Had this sly devil
contrived these circumstances himself, he could not have improved
them. By these he can justify himself at need to the Duke. Oh, he's
turned the tables on us. Now you see why I meant to give him no
chance.'
She kept her mind to the essence of the matter.
'Then if he comes against us, we are lost. We shall be caught
between his army and my uncle's.'
His overweening vanity would not permit him to admit, or even to
think, so much. He laughed, confident and disdainful.
'Have you so little faith in me, Valeria? I am no apprentice in this
art of war. And with the thought of you to spur me on, do you think
that I will suffer defeat? I'll not lay down my arms while I have life to
serve you. I will take measures to-morrow. And I will send letters to
the Duke, informing him of Bellarion's defection and begging
reenforcements. Can you doubt that they will come? Is Filippo Maria
the man to let one of his captains mutiny and go unpunished?' He
laughed again full of a confidence by which she was infected. And he
looked so strong and masterful, so handsome in the half-armour he
still wore, a very god of war.
She held out a hand to him. 'My friend, forgive my doubt. You
shall be dishonoured by no more fears of mine.'
He caught her hand. He drew her out of the chair, and towards
him until she brought up against his broad mailed breast. 'That is the
fine brave spirit that I love in you as I love all in you, Valeria. You are
mine, Valeria! God made us for each other.'
'Not yet,' she said, smiling a little, her eyes downcast and veiled
from his ardent glance.
'When then?' was his burning question.
'When Theodore has been whipped out of Montferrat.'
His arms tightened about her until his armour hurt her. 'It is a
pledge, Valeria?'
'A pledge?' she echoed on a questioning, exalted note.
'The man who does that may claim me when he wants me. I
swear it.'
CHAPTER XII

CARMAGNOLA'S DUTY

My Lord of Carmagnola had shut himself up in a small room on


the ground floor of the castle of Quinto to indite a letter to the High
and Most Potent Duke Filippo Maria of Milan. A heavy labour this of
quill on parchment for one who had little scholarship. It was a labour
that fell to him so rarely that he had never perceived until now the
need to equip himself with a secretary.
The Princess and her brother newly returned from Mass on that
Sunday morning, four days after Bellarion's escape, were together in
the armoury discussing their situation, and differing a good deal in
their views, for the mental eyes of the young Marquis were not
dazzled by the effulgence of Carmagnola's male beauty, or deceived
by his histrionic attitudes.
Into their presence, almost unheralded, were ushered two men.
One of these was small and slight and active as a monkey, the other
a fellow of great girth with a big, red, boldly humorous face, blue
eyes under black brows flanking a beak of a nose, and a sparse
fringe of grey hair straggling about a gleaming bald head.
The sight of those two, who smirked and bowed, brought brother
and sister very suddenly to their feet.
'Barbaresco!' she cried on a note of gladness, holding out both
her hands. 'And Casella!'
'And,' said Barbaresco, as he rolled forward, 'near upon another
five hundred refugees from Montferrat, both Guelph and Ghibelline,
whom we've been collecting in Piedmont and Lombardy to swell the
army of the great Bellarion and settle accounts with Master
Theodore.'
They kissed her hands, and then her brother's. 'My Lord Marquis!'
cried the fire-eating Casella, his gimlet glance appraising the lad.
'You're so well grown I should hardly have known you. We are your
servants, my lord, as madonna here can tell you. For years have we
laboured for you and suffered for you. But we touch the end of all
that now, as do you. Theodore is brought to bay at last. We are
hounds to help you pull him down.'
At no season could their coming have been more welcome or
uplifting than in this hour of dark depression, when recruits to the
cause of the young Marquis were so urgently required. This she told
them, announcing their arrival a good omen. Servants were
summoned, and despatched for wine, and whilst the newcomers
drank the hot spiced beverage provided they learnt the true meaning
of her words.
It sobered their exultation. This defection of Bellarion and his
powerful company amounting to more than half of the entire army
altered their outlook completely.
Barbaresco blew out his great cheeks, frowning darkly.
'You say that Bellarion is the agent of Theodore?' he cried.
'We have proof of it,' she sadly assured him, and told him of the
letter. His amazement deepened. 'Does it surprise you, then?' she
asked. 'Surely it should be no news to you!'
'Once it would not have been. For once I thought that I held proof
of the same; that was on the night that Spigno died at his hands.
Later, before that same night was out, I understood better why he
killed Spigno.'
'You understood? Why he killed him?' She was white to the lips.
Gian Giacomo was leaning forward across the table, his face eager.
She uttered a fretful laugh. 'He killed him because he was my friend,
mine and my brother's, the chief of all our friends.'
Barbaresco shook his great head. 'He killed him because this
Spigno whom we all trusted so completely was a spy of Theodore's.'
'What?'
Her world reeled about her; her senses battled in a mist. The
thick, droning voice of Barbaresco came to deepen her confusion.
'It is all so simple; so very clear. The facts that Spigno was
dressed as we found him and in the attic where we had imprisoned
Bellarion should in themselves have explained everything. How
came he there? Bellarion was all but convicted of being an agent of
Theodore's. But for Spigno we should have dealt with him out of
hand. Then at dead of night Spigno went to liberate him, and by that
very act convicted himself in Bellarion's eyes. And for that Bellarion
stabbed him. The only flaw is how one agent of Theodore's should
have come to be under such a misapprehension about the other.
Saving that the thing would have been clear at once.'
'That I can explain,' said Valeria breathlessly, 'if you have sound
proof of Spigno's guilt, if it is not all based on rash assumption.'
'Assumption!' laughed Casella, and he took up the tale. 'That
night, when we determined upon flight, we first repaired, because of
our suspicions, to Spigno's lodging. We found there a letter
addressed superscribed to Theodore, to be delivered in the event of
Spigno's death or disappearance. Within it we found a list of our
names and of the part which each of us had had in the plot to kill the
Regent, and the terms of that letter made it more than clear that
throughout Spigno had been Theodore's agent for the destruction of
the Marquis here.'
'That letter,' said Barbaresco, 'was a safeguard the scoundrel had
prepared in the event of discovery. The threat of its despatch to
Theodore would have been used to compel us to hold our hands.
Oh, a subtle villain, your best and most loyal friend Count Spigno,
and but for Bellarion ...' He spread his hands and laughed.
Then Casella interposed.
'You said, madonna, that you could supply the link that's missing
in our chain.'
But she was not listening. She sat with drooping head, her hands
listlessly folded in her lap.
'It was all true. All true!' Her tone seemed the utterance of a
broken heart. 'And I have mistrusted him, and ... Oh, God!' she cried
out. 'When I think that by now he might have been strangled and
with my consent. And now ...'
'And now,' cut in her brother almost brutally considering the pain
she was already bearing, 'you and that swaggering fool Carmagnola
have between you driven him out and perhaps set him against us.'
The swaggering fool came in at that moment with inky fingers and
disordered hair. The phrase that greeted him brought him to a halt on
the threshold, his attitude magnificent.
'What's this?' he asked with immense dignity.
He was told, by Gian Giacomo, so fiercely and unsparingly that he
went red and white by turns as he listened. Then, commanding
himself and wrapped in his dignity as in a mantle, he came slowly
forward. He even smiled, condescendingly.
'Of all this that you tell I know nothing. It may well be as you say. It
is no concern of mine. What concerns me is what has happened
here; the discovery that Bellarion was in correspondence with
Theodore, and his avowed intention to raise this siege; add to this
that he has slipped through our hands, and is now abroad to work
your ruin, and consider if you are justified in using hard words to me
but for whom your ruin would already have been encompassed.'
His majestic air and his display of magnanimity under their
reproach imposed upon all but Valeria.
It was she who answered him:
'You are forgetting that it was only my conviction that he had been
Theodore's agent aforetime which disposed me to believe him
Theodore's agent now.'
'But the letter, then?' Carmagnola was showing signs of
exasperation.
'In God's name, where is this letter?' growled the deep voice of
Barbaresco.
'Who are you to question me now? I do not know your right, sir, or
even your name.'
The Princess presented him and at the same time Casella.
'They are old and esteemed friends, my lord, and they are here to
serve me with all the men that they can muster. Let Messer
Barbaresco see this letter.'
Impatiently Carmagnola produced it from the scrip that hung
beside his dagger from a gold-embossed girdle of crimson leather.
Slowly Barbaresco spelled it out, Casella reading over his
shoulder. When he had done, he looked at Carmagnola, and from
Carmagnola to the others, first in sheer amazement, then in scornful
mirth.
'Lord of Heaven, Messer Carmagnola! You've the repute of a
great fighter, and, to be sure, you're a fine figure of a man; also I
must assume you honest. But I would sooner put my trust in your
animal strength than in your wits.'
'Sir!'
'Oh, aye, to be sure, you can throw out your chest and roar and
strut. But use your brains for once, man.' The boldly humorous red
face was overspread by a sardonic grin. 'Master Theodore took your
measure shrewdly when he thought to impose upon you with this
foxy piece of buffoonery, and, my faith, if Bellarion had been less
nimble, this trick would have served its purpose. Nay, now don't puff
and blow and swell! Read the letter again. Ask yourself if it would
have borne that full signature and that superscription if it had been
sincere, and considering that it imparts no useful information save
that Bellarion was betraying you, ask yourself if it would have been
written at all had anything it says been true.'
'The very arguments that Bellarion used,' cried the Marquis.
'To which we would not listen,' said the Princess bitterly.
Carmagnola sniffed. 'They are the arguments any man in his case
would use. You overlook that the letter is an incentive, an
undertaking to reward him suitably if he ...'
Barbaresco broke in, exasperated by the man's grandiose
stupidity.
'To the devil with that, numskull!'
'Numskull, sir? To me? By Heaven ...'
'Sirs, sirs!' The Princess laid her hand on Barbaresco's great arm.
'This is not seemly to my Lord Carmagnola ...'
'I know it. I know it. I crave his pardon. But I was never taught to
suffer fools gladly. I ...'
'Sir, your every word is an offence. You ...'
Valeria calmed them. 'Don't you see, Messer Carmagnola, that he
but uses you as a whipping-boy instead of me. It is I who am the
fool, the numskull in his eyes; for these deeds are more mine than
any other's. But my old friend Barbaresco is too courteous to say so.'
'Courteous?' snorted Carmagnola. 'That is the last term I should
apply to his boorishness. By what right does he come hectoring
here?'
'By the right of his old affection for me and my brother. That is
what makes him hot. For my sake, then, bear with him, sir.'
The great man bowed, his hand upon his heart, signifying that for
her sake there was no indignity he would not suffer.
Thereafter he defended himself with great dignity. If the letter had
been all, he might have taken Barbaresco's views. But it was, he
repeated, the traitor Bellarion's avowed intention to raise the siege.
That, in itself, was a proof of his double-dealing.
'How did this letter come to you?' Barbaresco asked.
Gian Giacomo answered whilst Valeria added in bitter self-
reproach, 'And this messenger was never examined, although
Bellarion demanded that he should be brought before us.'
'Do you upbraid me with that, madonna?' Carmagnola cried. 'He
was a poor clown, who could have told us nothing. He was not
examined because it would have been waste of time.'
'Let us waste it now,' said Barbaresco.
'To what purpose, sir?'
'Why, to beguile our leisure. No other entertainment offers.'
Carmagnola contained himself under that sardonic leer.
'Sir, you are resolved, it seems, to try my patience. It requires all
my regard and devotion for her highness to teach me to endure it.
The messenger shall be brought.'
At Valeria's request not only the messenger, but the captains who
had voted Bellarion's death were also summoned. Carmagnola
demurred at first, but bowed in the end to her stern insistence.
They came, and when they were all assembled, they were told by
the Princess why they had been summoned as well as what she had
that morning learnt from Barbaresco. Then the messenger was
brought in between the guards, and it was the Princess herself who
questioned him.
'You have nothing to fear, boy,' she assured him gently, as he
cowered in terror before her. 'You are required to answer truthfully.
When you have done so, and unless I discover that you are lying,
you shall be restored to liberty.'
Carmagnola, who had come to take his stand at her side, bent
over her.
'Is that prudent, madonna?'
'Prudent or not, it is promised.' There was in her tone an asperity
that dismayed him. She addressed herself to the clown.
'When you were given this letter you would be given precise
instructions for its delivery, were you not?'
'Yes, magnificent madonna.'
'What were those instructions?'
'I was taken to the ramparts by a knight, to join some other
knights and soldiers. They pointed to the lines straight ahead. I was
to go in that direction with the letter. If taken I was to ask for the Lord
Bellarion.'
'Were you bidden to go cautiously? To conceal yourself?'
'No, madonna. On the contrary. My orders were to let myself be
seen. I am answering truthfully, madonna.'
'When you were told to go straight ahead into the lines that were
pointed out to you, on which side of the ramparts were you
standing?'
'On the south side, madonna. By the southern gate. That is truth,
as God hears me.'
The Princess leaned forward, and she was not the only one to
move.
'Were you told or did you know what soldiers occupied the section
of the lines to which you were bidden?'
'I just knew that they were soldiers of the besieging army, or the
Lord Bellarion's army. I am telling you the truth, madonna. I was told
to be careful to go straight, and not to wander into any other part of
the line but that.'
Ugolino da Tenda made a sharp forward movement. 'What are
you saying?'
'The truth! The truth!' cried the lad in terror. 'May God strike me
dumb forever if I have uttered a lie.'
'Quiet! Quiet!' the Princess admonished him. 'Be sure we know
when you speak the truth. Keep to it and fear nothing. Did you hear
mention of any name in connection with that section of the line?'
'Did I?' He searched his mind, and his eyes brightened. 'Aye, aye,
I did. They spoke amongst them. They named one Calmaldola, or ...
Carmandola ...'
'Or Carmagnola,' da Tenda cut in, and laughed splutteringly in
sheer contempt. 'It's clear, I think, that Theodore's letter was
intended for just the purpose that it's served.'
'Clear? How is it clear?' Carmagnola's contempt was in the
question.
'In everything, now that we have heard this clown. Why was he
sent to the southern section? Do you suppose Theodore did not
know that Valsassina himself and those directly under him, of whom I
was one, were quartered in Quinto, on the western side?' Then his
voice swelled up in anger. 'Why was this messenger not examined
sooner, or ...' he checked and his eyes narrowed as they fixed
themselves on Carmagnola's flushed and angry face '... or, was he?'
'Was he?' roared Carmagnola. 'Now what the devil do you mean?'
'You know what I mean, Carmagnola. You led us all within an ace
of doing murder. Did you lead us so because you're a fool, or a
villain? Which?'
Carmagnola sprang for him, roaring like a bull. The other captains
got between, and the Princess on her feet, commanding, imperious,
added her voice sharply to theirs to restore order. They obeyed that
slim, frail woman, scarcely more than a girl, as she stood there
straight and tense in her wine-coloured mantle, her red-gold head so
proudly held, her dark eyes burning in her white face.
'Captain Ugolino, that was ill said of you,' she reproved him. 'You
forget that if this messenger was not examined before, the blame for
that is upon all of us. We took too much for granted and too readily
against the Prince of Valsassina.'
'It is now that you take too much for granted,' answered
Carmagnola. 'Why did Valsassina intend to raise this siege if he is
honest? Answer me that!'
His challenge was to all. Ugolino da Tenda answered it.
'For some such reason as he had when he sent his men to hold
the bridge at Carpignano while you were building bridges here.
Bellarion's intentions are not clear to dull eyes like yours and mine,
Carmagnola.'
Carmagnola considered him malevolently. 'You and I will discuss
this matter further elsewhere,' he promised him. 'You have used
expressions I am not the man to forget.'
'It may be good for you to remember them,' said the young
captain, no whit intimidated. 'Meanwhile, madonna, I take my leave. I
march my condotta out of this camp within an hour.'
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebooknice.com

You might also like