Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- #include <cstdlib>
- using namespace std;
- void fill_matrix()
- {
- unsigned int a[5][7];
- for(unsigned int i = 0; i < 7; i++)
- a[0][i] = 1;
- for(unsigned int i = 0; i < 5; i++)
- a[i][0] = 1;
- for(unsigned int i = 1; i < 5; i++)
- for(unsigned int j = 1; j < 7; j++)
- a[i][j] = (a[i-1][j] + a[i][j-1]) % 10;
- for(unsigned int i = 0; i < 5; i++)
- {
- for(unsigned int j = 0; j < 7; j++)
- cout << a[i][j] << " ";
- cout << "\n";
- }
- }
- void fii(unsigned int n)
- {
- for(unsigned int a = n; a * a > n; --a)
- {
- if(n % a == 0)
- {
- unsigned int b = n / a;
- cout << "(" << a << " " << b << ") ";
- }
- }
- }
- void elim_neg()
- {
- char sir[101];
- cin.get(sir, 101);
- cin.get();
- for(unsigned int i = 1; i < strlen(sir); ++i)
- {
- if(sir[i-1] == '-' && sir[i] >= '0' && sir[i] <= '9')
- {
- while((sir[i] >= '0' && sir[i] <= '9') || sir[i] == ',')
- strcpy(sir + i, sir + 1 + i);
- strcpy(sir + i, sir + 1 + i);
- strcpy(sir - 1 + i, sir + i);
- }
- }
- cout << sir;
- }
- void max_3_20()
- {
- unsigned int max1, max2, max3, x;
- max1 = max2 = max3 = 0;
- ifstream f("bac.in");
- while (f >> x)
- {
- if (x % 100 == 20)
- {
- if (x > max1)
- max1 = x;
- else if (x > max2)
- max2 = x;
- else if (x > max3)
- max3 = x;
- }
- }
- cout << max3 << " " << max2 << " " << max1;
- }
- int main()
- {
- fill_matrix();
- fii(100);
- elim_neg();
- max_3_20();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement