fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int stt = 1;
  4. void pt(int n)
  5. {
  6. cout << "Test " << stt++ << ": ";
  7. for (int i = 2; i<=sqrt(n); i++)
  8. {
  9. int dem = 0;
  10. if (n%i==0)
  11. {
  12. while (n%i==0)
  13. {
  14. ++dem;
  15. n/=i;
  16. }
  17. cout << i << "(" << dem << ")" << " ";
  18. }
  19. }
  20. if (n > 1) cout << n << "(1)";
  21. cout << endl;
  22. }
  23. int main()
  24. {
  25. int t; cin >> t;
  26. while (t--)
  27. {
  28. int n; cin >> n;
  29. pt(n);
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty