Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
2021(M2)Simulare:S3:1
//g++ 7.4.0 #include <iostream> using namespace std; bool prim(int n) { for(int a = 2; a < n / 2; a ++) { if( n % a == 0) { return false; } } return true; } int main() { int n; cin>>n; int putere = -1, factor = -1; for(int i = 2; i < n; i ++) { if(!prim(i)) { continue; } int c = 0; while(n % i == 0) { n /= i; c++; } if(putere == -1 && factor == -1) { putere = c; factor = i; } if( c != 0 && c < putere) { putere = c; factor = i; } } cout<< factor; }
run
|
edit
|
history
|
help
0
MyString
Testul 11(2021)
Problem: binary
Cross Multiplication
subset sum=k(Recursion)
member initial list
N Queens problem
Tower of hanoi
Cuantos
Expected types