# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424663 | A_D | Toys (CEOI18_toy) | C++14 | 0 ms | 204 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define ii pair<int,int>
#define F first
#define S second
#define du long double
using namespace std;
const int N=1e8+5;
bool freq[N];
vector<int> vec;
void solve()
{
int n;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
for(int k=1;k<=n;k++){
if((i*j*k)==n){
if(freq[i+j+k])continue;
freq[i+j+k]=1;
cout<<i<<" "<<j<<" "<<k<<endl;
}
}
}
}
/*
for(int i=1;i<=n;i++){
for(int j=1;j*i<=n;j++){
int u=i*j;
if(n%u==0){
int v=n/u;
if(freq[i+j+v])continue;
cout<<i<<" "<<j<<" "<<v<<endl;
freq[i+j+v]=1;
}
}
}
*/
for(int i=1;i<=n+3;i++){
if(freq[i])vec.push_back(i-3);
}
int sz=vec.size();
printf("%lld\n",sz);
for(auto x:vec)printf("%lld ",x);
}
main()
{
int t=1;
//cin>>t;
while(t--)solve();
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |