답안 #124271

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
124271 2019-07-02T22:55:53 Z RafikHachana Toys (CEOI18_toy) C++14
19 / 100
5000 ms 380 KB
#include<bits/stdc++.h>
using namespace std;
 
int n;
int ma;
set<int> s;



void f(int r,int p,int sum)
{
  if(r==0)
  {

    if(n%p==0)
    {
      int x = n/p -1;
      //cout<<x<<endl;
      if(x>0)
      {
        s.insert(sum+x);
      }
    }
    return;
  }
  for(int i=ma+5;i>0;i--)
  {
    //v.push_back(i);
    f(r-1,p*(i+1),sum+i);
    //v.pop_back();
  }
}

int main()
{
  cin>>n;
  s.insert(n-1);
  int r = 2;
  while(true)
  {
    ma= ceil(pow(n,1.0/r));
    //cout<<ma<<endl;
    //cout<<456<<endl;
    //vector<int> w;
    f(r-1,1,0);
    //f(r,w);
    if(ma<=2) break;
    r++;
  }
  cout<<s.size()<<endl;
  for(auto it:s) cout<<it<<" ";
    cout<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 252 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 252 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Execution timed out 5091 ms 380 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 252 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Execution timed out 5091 ms 380 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 252 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Execution timed out 5091 ms 380 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 252 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 252 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 256 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Execution timed out 5091 ms 380 KB Time limit exceeded
27 Halted 0 ms 0 KB -