Cod sursa(job #2922526)
| Utilizator | Data | 8 septembrie 2022 19:41:53 | |
|---|---|---|---|
| Problema | Radix Sort | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.42 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("radixsort.in");
ofstream fout ("radixsort.out");
int main(){
multiset<int>ans;
int n, a, b, c; fin >> n >> a >> b >> c;
ans.insert(b);
int q = b, cnt = 0;
for (int i = 2; i <= n; i++){
q = (a * q + b) % c;
ans.insert(q);
}
for (int x : ans){
if (cnt % 10 == 0){
fout << x << " ";
}
cnt += 1;
}
}
