# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
260572 |
2020-08-10T14:24:33 Z |
stefantaga |
Toys (CEOI18_toy) |
C++14 |
|
1 ms |
384 KB |
#include <bits/stdc++.h>
using namespace std;
int valori[100005],q1,n,q,divi[100005],solutii[100005],fin;
void back1(int nr,int suma,int prod)
{
if (prod==n)
{
valori[++q1]=suma-nr;
return;
}
int i;
for (i=1;i<=q;i++)
{
if ((n/prod)%divi[i]==0)
{
back1(nr+1,suma+divi[i],prod*divi[i]);
}
}
}
int i;
int main()
{
#ifdef HOME
ifstream cin("date.in");
ofstream cout("date.out");
#endif // HOME
cin>>n;
for (i=1;i*i<=n;i++)
{
if (n%i==0)
{
if (i!=1)
{
divi[++q]=i;
}
divi[++q]=n/i;
}
}
back1(0,0,1);
sort (valori+1,valori+q1+1);
for (i=1;i<=q1;i++)
{
if (valori[i]!=valori[i-1])
{
solutii[++fin]=valori[i];
}
}
cout<<fin<<'\n';
for (i=1;i<=fin;i++)
{
cout<<solutii[i]<<" ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |