Cod sursa(job #2646160)
| Utilizator | Data | 31 august 2020 09:59:59 | |
|---|---|---|---|
| Problema | Radix Sort | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 1e6 + 6;
int main() {
// ios::sync_with_stdio(0);
// cin.tie(0); cout.tie(0);
freopen("radixsort.in", "r", stdin);
freopen("radixsort.out", "w", stdout);
long long n, A, B, C;
cin >> n >> A >> B >> C;
int a[n]; a[0] = B;
for(int i=1; i<n; i++) a[i] = (1LL * A * a[i-1] + B) % C;
sort(a, a+n);
for(int i=0; i<n; i+=10) cout << a[i] << " ";
return 0;
}