Correction bac pratique 2012 g1

Similar documents
Correction Bac pratique 28/05/2012 8h30

Corrections proposées par Mr Adnen Smii. Propositions de correction Bac Pratique informatique 4 scientifiques -27 mai h

Correction proposée par Mr Najeh SOUGUIR 1/8

sujet1: Correction Des Epreuves D Informatique _--Pratique--_ MEDDEB Mohamed Page 1 Devoirs et examens :

SERIE N 1. 4 ème Année informatiques. Exercice 3. Exercice 4 (Manuel Scolaire) Page [1] Les enregistrements & Les fichiers Infoslpm.e-monsite.

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

TD 2. Correction TP info

In Delphi script, when values are assigned to variables, the colon-equal operator is used; :=

TD : Compilateur ml2java semaine 3

COMPUTER SCIENCES II Spring Term 2017 Asst.Prof.Elgin KILIÇ

with Ada.Numerics.Float_Random; with Ada.Containers.Vectors; procedure CalculDeMatrices is

Ecole Nationale d Ingénieurs de Brest. Programmation par objets Le langage C++ Type Concret de Données en C++

DÉVELOPPER UNE APPLICATION IOS

Bridging Activity for September A level Computer Science. Why do I need to complete a bridging activity?

Description de tous les champs du fichier de statut de retour pour l échange FATCA - version 0.4

GOZO COLLEGE. Boys Secondary Victoria - Gozo, Malta Ninu Cremona. Half Yearly Examination

Pascal program for the bilinear imputation

Préparation au concours ACM TP 2

Input parameters. Function. An ideal black-box representation of a function

free download pnu pdf file from

Table 1. Subset Pascal Grammar

<?php. file_get_contents( cours.txt ) /* Persistance côté serveur */ /* */

Tutorial 1 : minimal example - simple variables replacements

REPORT ytestjro. DATA: * Déclaration des tables internes : lt_sflight TYPE STANDARD TABLE OF sflight, lt_fldcat TYPE lvc_t_fcat. START-OF-SELECTION.

Algorithmes certifiants

RSA SIGNATURE: BEHIND THE SCENES

(************************ Instructions de base ************************) #open "graphics";; open_graph " 800x ";; (* SORTIE : - : unit = () *)

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '84 } { -- PASCAL PROGRAM SOLUTIONS }

(************************ Instructions de base ************************)

Computer Science II TURBO PASCAL

BINARNE DATOTEKE. program IspisDat; uses wincrt; var f:file of integer; x,i:integer; begin assign(f,'d:\bodovi'); reset(f); for i:=1 to filesize(f) do

Guide Logiciel Mikroc En Francais

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '83 } { -- PASCAL PROGRAM SOLUTIONS }

CSE443 Compilers. Dr. Carl Alphonce 343 Davis Hall

Formation. Application Server Description du cours

Getting Started With Pascal Programming

Package CUFF. May 28, 2018

Parallel Algorithms. Parallel Algorithms

ISO/TS TECHNICAL SPECIFICATION

Compilation TP 0.0 : The target architecture: Digmips

208 FLORIDA HIGH SCHOOLS COMPUTING COMPETITION

Vol. 40 No Journal of Jiangxi Normal University Natural Science Jan. 2016

Utilisez Mutant / Mutest pour améliorer vos tests, votre code Sigilium

{ -- FLORIDA HIGH SCHOOLS COMPUTING COMPETITION '91 } { -- PASCAL PROGRAM SOLUTIONS }

Graphs and Networks The (, D) problem

Computer Science II TURBO PASCAL

MARK SCHEME for the October/November 2013 series 9691 COMPUTING. 9691/21 Paper 2 (Written Paper), maximum raw mark 75

... ; ako je a n parno. ; ako je a n neparno

Getting Started With Pascal Programming

Chapter 11 - The Countdown Problem

TP5 Sécurité IPTABLE. * :sunrpc, localhost :domain,* :ssh, localhost :smtp, localhost:953,*: Tous sont des protocoles TCP

Chapter 7 Arrays. One-Dimensional Arrays. Fred Jack. Anna. Sue. Roy

Réinitialisation de serveur d'ucs série C dépannant TechNote

Improving display and customization of timetable in Indico Pierre-Luc, Hémery Jose Benito, Gonzalez Lopez 20 August 2008 Version 1

98 FLORIDA HIGH SCHOOLS COMPUTING COMPETITION

ILLUSTRATION DES EXCEPTIONS

Analyse Factorielle Multiple (AFM) avec FactoMineR sur la description sensorielle de vins François Husson

FIRST YEAR EXAM INFORMATION SESSION November 2017

The Personal Information Canadians Give to Retailers

Internet Office 120V 600VA 300W Standby UPS, Ultra-Compact Desktop, USB

DOWNLOAD OR READ : WINDOWS SERVER 2008 R2 SQL SERVER 2008 R2 HIGH AVAILABILITY CLUSTERING PROJECT SERIES PDF EBOOK EPUB MOBI

Développement Web 2. Bertrand Estellon. April 1, Aix-Marseille Université. Bertrand Estellon (AMU) Développement Web 2 April 1, /

Algorithm 123 SINGLE TRANSFERABLE VOTE BY MEEK S METHOD

Guide Logiciel Mikroc En Francais

5. Enterprise JavaBeans 5.3 Entity Beans. Entity Beans

Hyrje ne Informatike Seminar 5

# Project Tracker Status Priority Subject Updated Category Target version 559 Auto Multiple 05/09/2018 1/10

XML & DBs Interrogation des documents XML

Analyse statique de programmes avioniques

History. used in early Mac development notable systems in Pascal Skype TeX embedded systems

Unicode 5.0 En Pratique (French Edition) By Patrick Andries

DelphiScript Keywords

EFFECTIVE NUMERICAL ANALYSIS METHOD APPLIED TO THE ROLL-TO-ROLL SYSTEM HAVING A WINDING WORKPIECE

Beginning Programming (Pascal) Lecture 21

Canada s Energy Future:

Excel 2016 Et Vba Pour Les Nuls M Gapoche

Making Decisions In Pascal

Getting Started With Pascal Programming

ISO/IEC INTERNATIONAL STANDARD

THE EVOLUTION OF CONTENT CONSUMPTION ON MOBILE AND TABLETS

TP 3 des architectures logicielles Séance 3 : Architecture n-tiers distribuée à base d EJB. 1 Préparation de l environnement Eclipse

C:\MasterPageWeb\HAPR\docu\HAPR_VB6_version15sept06.rtf 19/10/08. HARP_VB projet en VB6

Web Sémantique TD 1 - RDF

YOUR CONTACT: Cédric BENSOUSSAN Phone: +33(0) HOLOROTOR PRO SOFTWARE USER GUIDE

122 FLORIDA HIGH SCHOOLS COMPUTING COMPETITION

I PISMENI ZADATAK III6 I GRUPA IME I PREZIME

Projet 0 - Correc,on. Structures de données et algorithmes

Compiladores Prof. Bruno Lopes Lista 1

Java et Mascopt. Jean-François Lalande, Michel Syska, Yann Verhoeven. Projet Mascotte, I3S-INRIA Sophia-Antipolis, France

Premiers retours d expérience sur l utilisation de GPU pour des applications de mécanique des structures

ECE 2574: Data Structures and Algorithms - Recursion Part I. C. L. Wyatt

e-privacy, Big Data, plateformes en ligne ce que les institutions européennes réservent dans les prochains mois aux entreprises du marketing direct

Bil Reference Manual. Patrick Dangla. The documentation for Bil 2.4 A modeling platform based on finite element/volume methods

Pascal: operations on basic data structures (selection) (I) 2.3 Accessing and manipulating data

arrays Simple Types (Atomic) In this section of notes you will be introduced to a homogeneous composite type, onedimensional 1) Integer 2) Real

Active WireFrame Plugin for PimCore

Debugging Program Slicing

THE ALGORITHM DANTZING

C-DIAS Analogue Output Module CAO 082 for eight ±10V DC respectively eight 0 20mA DC outputs

Transcription:

Bac pratique 2012 g1 Correction bac pratique 2012 g1 program FactPrem; uses wincrt; type fdat=file of integer; tab=array[1..20] of string; var fd:fdat; ft:text;n,p,d:integer;decomp:tab; {***** fonction verif *********} function verif(n,p:integer):boolean; var chn:string; str(n,chn); verif:=(length(chn)=p); {******** remplissage *******} procedure remplir(var fd:fdat; n,p:integer); var i,v:integer; rewrite(fd); for i:=1 to n do write('saisir un entier de ',p, ' chiffres: '); readln(v); until verif(v,p); write(fd,v); {*********** affichage fichier de donné&es ********} procedure affiche1(var f:fdat); var ch:string; reset(f); while(not(eof(f)))do read(f,n); writeln('---->',n); {*********** affichage fichier texte ********} procedure affiche(var ft:text); var ch:string; Page 1 sur 3

Bac pratique 2012 g1 reset(ft); while(not(eof(ft)))do readln(ft,ch); writeln('---->',ch); readln; {*********** decomposition en facteur premier ******} procedure decompfact(var T:tab;var n:integer;v:integer); var i:integer; chi:string; i:=2; n:=0; while (v<>1) do if(v mod i=0)then n:=n+1; str(i,chi); T[n]:=chi; v:=v div i; end {************ generation de la frequence des facteurs premiers ****} function genere(t:tab;d:integer):string; var c:char; n,i:integer;chg,chn,ch:string; chg:='';ch:=t[1]; n:=1;i:=1; if(t[i]=ch)then n:=n+1 str(n,chn); chg:=chg+chn+ch; ch:=t[i]; n:=1; until(i>d); genere:=chg; Page 2 sur 3

Bac pratique 2012 g1 {************ decomposition *******} procedure decomposition (var fd:fdat; var ft:text; n:integer); var chdecomp,chg:string; v,i,j:integer; reset(fd); rewrite(ft); for i:=1 to n do read(fd,v); decompfact(decomp,d,v); {***** afficage de décomposition en facteurs premiers *****} write(v,' = '); for j:=1 to d-1 do write(decomp[j],','); writeln(decomp[d]); chg:=genere(decomp,d); writeln(ft,chg); {********* programme principal *******} write('saisir N: '); readln(n); until (n>2) and (n<100); write('saisir P: '); readln(p); until (p>2) and (p<6); assign(fd,'nombres.dat'); assign(ft,'facteurs.txt'); end. remplir(fd,n,p); clrscr; writeln('------------ Le contenu du fichier Nombres.dat ---------'); decomposition(fd,ft,n); writeln('------------ Le contenu du fichier Facteurs.txt ---------'); affiche(ft); Page 3 sur 3

Correction bac pratique 2012 g2 program PremCir; uses wincrt; type fdat= file of integer; var f:fdat; p,q:integer; {* ***** fonction premier ******} function premier(n:integer):boolean; var nbd,i:integer; nbd:=0; for i:=1 to n do if(n mod i=0)then nbd:=nbd+1; premier:=(nbd=2); function permut_cir(ch:string):integer; var i,n,e:integer; c:char; c:=ch[length(ch)]; for i:=length(ch) downto 2 do ch[i]:=ch[i-1]; ch[1]:=c; val(ch,n,e); permut_cir:=n; {********** fonction circulaire *************} function circulaire(n:integer):boolean; var ok:boolean;p:integer; ch:string; str(n,ch); ok:=true; p:=permut_cir(ch); if(premier(p)=false)then ok:=false str(p,ch); until(ok=false) or(p=n); Page 1 sur 2

circulaire:=ok; {****** nombre premier circulaire ******} procedure nb_premier_cir(var f:fdat; p,q:integer); var i:integer; rewrite(f); for i:=p to q do if(premier(i))then if(circulaire(i))then write(f,i); {*********** affichage fichier de donné&es ********} procedure affiche(var f:fdat); var ch:string; n:integer; reset(f); while(not(eof(f)))do read(f,n); writeln('---->',n); readln; {******** programme principal *********} assign(f,'cicul.dat'); write('saisir p: '); readln(p); write('saisir q: '); readln(q); until(p>10) and(p<q) and (q<20000); nb_premier_cir(f,p,q); clrscr; writeln('------------ Le contenu du fichier Circ.dat ---------'); affiche(f); end. Page 2 sur 2

Correction bac pratique 2012 g3 procedure affiche(var ft:text); var ligne:string; i:integer; reset(ft); i:=0; while not(eof(ft)) do readln(ft,ligne); writeln('u',i,' = ',ligne); function construction(u:string):string; var i,n:integer; c:char; ch,chn:string; i:=1;c:=u[1];ch:=''; n:=1; if(u[i]=c)then n:=n+1 str(n,chn); ch:=ch+chn+c; c:=u[i]; n:=1; until (i>length(u)); construction:=ch; {********** suite de robinson ********} procedure suite_robinson(var ft:text;n:integer); var u:string; k:integer; rewrite(ft); u:='0'; writeln(ft,u); for k:=1 to n do u:=construction(u); writeln(ft,u); Page 1 sur 2

{*********** prgramme principal ******} assign(ft,'robinsontxt'); write('saisir k : '); readln(k); until k in [2..15]; writeln('--------------------------------------'); writeln('----- SUITE DE ROBINSON --------------'); writeln('--------------------------------------'); suite_robinson(ft,k); affiche(ft); end. Page 2 sur 2