Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace goodNumber
- {
- class MainClass
- {
- public static List<long> d = new List<long> {};
- public static bool prost(long x){
- long c = (long)Math.Sqrt(x);
- for(long i = 2; i <= c;i++)
- if (x % i == 0)
- return false;
- return true;
- }
- public static void Main ()
- {
- string[] num = Console.ReadLine().Split(' ');
- long n = long.Parse(num[0]);
- long k = long.Parse(num[1]);
- bool f = false;
- //-----------------------------------------------
- for (long i = 2; i <= n; i++) {
- if (n % i == 0 && (prost (i) || (i == k * k && f == true))) {
- if (i != k) {
- while (n % i == 0) {///есть подозрения что это я на говнокодил и можно прже(этот вайл)
- n = (long)n / i;
- d.Add (i);
- }
- }
- else
- f = true;
- }
- if(n <= 1)
- break;
- }
- d.Sort();
- //-----------------------------------------------
- if (n > 1)
- Console.Write (-1);
- else
- for(int j = 0;j<d.Count;j++){
- Console.Write (d [j]);
- Console.Write (" ");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement