You are on page 1of 2

S1

1. b)
2. a)
3. b)
4. d) (48576)
5. c), d)

S2
1. int lmax=-1;
for (int i=0; i<20; i++)
if (c[i].frecv>2 && strlen(c[i].cuv)>lmax)
lmax=strlen(c[i].cuv);
cout<<lmax;
2. if (i%2==0) {
if (j<2)
A[i][j]='a';
else
A[i][j]='b';
}
else {
if (j<2)
A[i][j]='A';
else
A[i][j]='B';
}
3. a) 49 35
b) 2 3
c) #include <iostream>

using namespace std;

int main() {
int a, b, k=0, q=0, x, y;
cin>>a>>b;
for (x=1; x<=a; x++)
for (y=1; y<=b; y++) {
if (y%x==0)
k+=y;
else
q+=y;
}
cout<<k<<' '<<q;
return 0;
}
d) citeste a, b
k<-0; q<-0
x<-1
|-cat timp x<=a executa
| |-pentru y<-1, b executa
| | |-daca y%x=0 atunci
| | | k<-k+y
| | | altfel
| | | q<-q+y
| | |-
| |-
| x<-x+1
|-
S3
1. #include <iostream>
#include <cstring>

using namespace std;

int main() {
char s1[41]="", s2[83]="";
cin.getline(s1, 41);
cin.getline(s2, 41);
int poz=0;
for (int i=0; i<strlen(s1)-1; i++) {
if (strchr("aeiou", s1[i])!=NULL) {
strcpy(s2+poz+1, s2+poz);
//for (int j=strlen(s2)+1; j>poz; j--) {
// s2[j]=s2[j-1];
//}
s2[poz]=s1[i];
strcpy(s1+i, s1+i+1);
poz+=2;
}
}
cout<<s1<<' '<<s2;
return 0;
}

2.

You might also like