Cod sursa(job #508004)

Utilizator theodora_maneaManea Theodora Maria theodora_manea Data 7 decembrie 2010 12:10:15
Problema Potrivirea sirurilor Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 1.59 kb
#include <stdio.h>


a:array[97..122] of integer;
s:string;

readln(s);
n=length(s);
for i=1 to n do begin
	x=ord(s[i]);
    if (x>=97 and x<=122 do a[x]=a[x]+1;
	end;
max=0;
for i=122 downto 97 do 
	if (a[i]>=max) ch=char(i);

writeln(ch);

	if a[i]>max 
		void adancime(point *p,int k) {
	if (p==NULL) return;
    if (k>max) max=k;
	adancime(p->fs,k+1);
	adancime(p->fd,k-1);
}

type cerc=record
     o_x,o_y,raza:integer;
	 end;
	cilindru=record;
	h,volum:integer;
	baza:cerc;
	end;
var x:cilindru; y:cerc;

  x.baza.raza
x.volum.o_x
x.y.raza
x.h.raza

AICI NU STIU DACA MAI E CEVA IN AFARA DE c :-?? 

2. var a:array[1..100] of string; 
   s:string;
   s1:string;
   readln(s);        
   n=length(s);
   for i=1 to n do 
	   a[i]=copy(s,i,n-i+1);

for (i=1 to n-1 do 
	for  j=i+1 to n do 
		if (a[i]>a[j]) do begin
			s1=a[i];
			a[i]=a[j];
			a[j]=s1;
		    end;
		
for (i=1 to n do 
	writeln(a[i]);

		
	
E C-ul!!! ASA CRED



void minmax(point* p,int &min,int &max) {
	if (p) {
	if (p->inf>max) max=p->inf;
	if (p->inf<min) min=p->inf;
	minmax(p->fs,min,max);
	minmax(p->fd,min,max);
	}
}

void calcsuma(point *p,int nr,int s) {
	if (p) {
	if (nr==k) s+=p->inf;
	calcsuma(p->fs,nr+1,s);
	calcsuma(p->fd,nr-1,s);
	}
}
	
			
	

int main () {
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	p=creare();
	max=0;
	adancime(p,1);
    printf("%d\n",max-1);
	min=0;
	max=4000;
	minmax(p,max,min);
	printf("%d %d\n",min,max);
	scanf("%d",&k);
	s=0;
	nr=0;
	calcsuma(p,nr,s);
	printf("%d\n",s);
	return 0;
}