This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream.h> | |
ofstream f("bac.txt"); | |
void main() { | |
int n, v[300], i, p = 0, ip = 0, gasit; | |
cin >> n; | |
for (i = 1; i <= n * 3; i++) | |
cin >> v[i]; | |
gasit = 0; | |
i = 1; | |
while (i <= n && !gasit) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream.h> | |
long sub(long n) { | |
if (n <= 5) | |
return n; | |
else { | |
long k = 5; | |
while (k <= n) | |
k = k * 2; | |
return k / 2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream.h> | |
#include <math.h> | |
ifstream f("bac.txt"); | |
void main() { | |
int n, m = 0, x, a[50], i; | |
f >> n; | |
for (i = 1; i <= n; i++) { | |
f >> x; | |
if (sqrt(x) == floor(sqrt(x))) { | |
m++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream.h> | |
int a[100], n, b[100], m, c[200], p; | |
void sub(int n, int m, int a[100], int b[100]) { | |
int i, j, k; | |
i = j = k = 1; | |
while (i <= n && j <= m) | |
if (a[i] < b[j]) | |
c[k++] = a[i++]; | |
else | |
c[k++] = b[j++]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int i, n, p, x, j, a[30][30]; | |
cin >> n >> p; | |
x = 1; | |
for (i = 0; i < n; i++) | |
for (j = 0; j < p; j++) { | |
a[i][j] = x * x; | |
x = x + 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void sub(int n, int k) { | |
int i; | |
for (i = n; i >= 1; i--) | |
cout << i * k << " "; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream.h> | |
ifstream fin("numere.in"); | |
long f[1000]; | |
void main() { | |
long k; | |
int x, y; | |
while (fin >> k) | |
if (k >= 100 && k <= 999) | |
f[k]++; | |
x = 999; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int i, n, m, x, y = 0, j, a[30][30]; | |
cin >> m >> n; | |
for (i = 0; i < m; i++) | |
for (j = 0; j < n; j++) | |
cin >> a[i][j]; | |
for (i = 0; i < m; i++) { | |
x = a[i][0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream.h> | |
#include <math.h> | |
void main() { | |
int n, k, d; | |
cin >> n; | |
d = 1 + 8 * n; | |
k = (-1 + sqrt(d)) / 2; | |
if (k * (k + 1) / 2 == n) | |
cout << 1; | |
else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream.h> | |
long int n; | |
int d, k, max, nr; | |
int main() { | |
nr = max = 0; | |
cin >> n; | |
for (int i = 1; i <= n; i++) { | |
k = 1; | |
d = 1; | |
while (d <= i / 2) { |