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> | |
void main() { | |
int i, j, n, a[25][25]; | |
cin >> n; | |
for (i = 1; i <= n; i++) | |
for (j = 1; j <= i; j++) { | |
a[i][j] = i; | |
a[j][i] = i; | |
} | |
for (i = 1; i <= n; i++) { |
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 f("f.in"); | |
void main() { | |
int x[10001], lmax = 0, pmax, l, i; | |
l = 1; | |
i = 1; | |
f >> x[i]; | |
i++; | |
while (f >> x[i]) { | |
if (x[i - 1] % 2 != x[i] % 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> | |
ifstream f("date.txt"); | |
void main() { | |
int i, j, k, n, m, a[3000], b[3000], c[6000]; | |
f >> n >> m; | |
for (i = 1; i <= n; i++) | |
f >> a[i]; | |
for (i = 1; i <= m; i++) | |
f >> b[i]; | |
i = 1; |
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 numar(int x, long y) { | |
long p = 1; | |
while (p <= y) | |
p = p * x; | |
return p / x; | |
} | |
void main() { cout << numar(2, 18); } |
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 f("date.in"); | |
void main() { | |
int n, m, a[1000], x, y, i, k = 1, max = 0, xm, ym; | |
f >> n >> m; | |
for (i = 1; i <= n; i++) | |
f >> a[i]; | |
f >> x; | |
i = 1; | |
while (a[i] < x) |
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 verif(int a[100], int n) { | |
int p = 0; | |
for (int i = 1; i <= n; i++) | |
if (a[i] <= 0) | |
p--; | |
else if (a[i] >= 0) | |
p++; | |
if (p < 0) | |
return -1; |
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() { | |
long s; | |
cin >> s; | |
long x = s / 3; | |
if (s % 3 == 0) | |
cout << x << " " << x << " " << x; | |
if (s % 3 == 1) | |
cout << x << " " << x << " " << x + 1; |
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 <string.h> | |
void main() { | |
char s[20], x[20] = "", y[20] = ""; | |
cin.get(s, 20); | |
int i = 0; | |
while (s[i] != ' ') { | |
x[i] = s[i]; | |
i++; | |
} |
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 f("numar.in"); | |
void main() { | |
long n; | |
int aux, i, c1, c2, a[10], nr = 0; | |
f >> n; | |
cout << endl; | |
while (n / 10 && n % 10 < n / 10 % 10) { | |
nr++; | |
a[nr] = n % 10; |
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 dcm(int a, int b) { | |
while (a != b) | |
if (a > b) | |
a = a - b; | |
else | |
b = b - a; | |
return a; | |
} | |
void main() { |