library

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub beet-aizu/library

:heavy_check_mark: test/aoj/NTL_1_A.test.cpp

Depends on

Code

// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A

#include <bits/stdc++.h>
using namespace std;

#define call_from_test
#include "../../math/factorize.cpp"
#undef call_from_test

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;

  auto mp=factorize(n);

  cout<<n<<":";
  for(auto p:mp)
    for(int i=0;i<p.second;i++)
      cout<<" "<<p.first;
  cout<<endl;
  return 0;
}
#line 1 "test/aoj/NTL_1_A.test.cpp"
// verification-helper: PROBLEM http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_A

#include <bits/stdc++.h>
using namespace std;

#define call_from_test
#line 1 "math/factorize.cpp"

#line 3 "math/factorize.cpp"
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
map<T, int> factorize(T x){
  map<T, int> res;
  for(int i=2;i*i<=x;i++){
    while(x%i==0){
      x/=i;
      res[i]++;
    }
  }
  if(x!=1) res[x]++;
  return res;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
  return 0;
}
#endif
#line 8 "test/aoj/NTL_1_A.test.cpp"
#undef call_from_test

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  int n;
  cin>>n;

  auto mp=factorize(n);

  cout<<n<<":";
  for(auto p:mp)
    for(int i=0;i<p.second;i++)
      cout<<" "<<p.first;
  cout<<endl;
  return 0;
}
Back to top page