Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <stdio.h>
- #include <stdlib.h>
- using namespace std;
- int compare (const void * a, const void * b)
- {
- return ( *(int*)a - *(int*)b );
- }
- int main()
- {
- int a, b, d, n, l;
- cin >> d >> n;
- l = d * n;
- char tab[l];
- for (int i = 0; i < l; i++)
- {
- tab[i] = 'x';
- }
- for (int i = 0; i < n; i++)
- {
- cin >> a >> b;
- for (a; a < d; a = a + b)
- {
- for (int j = 0; j < l; j++)
- {
- if (tab[j] == 'x')
- {
- tab[j] = a;
- }
- }
- }
- }
- qsort (tab, 6, sizeof(int), compare);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement