답안 #483363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
483363 2021-10-28T23:56:43 Z Ozy Toys (CEOI18_toy) C++17
0 / 100
1 ms 204 KB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define debug(a) cout << #a << " = " << a << endl
#define debugsl(a) cout << #a << " = " << a << ", "

lli n,total;
vector<lli> res;

void solve(lli div, lli sum, lli num) {

    for (lli i = div; (i*i) <= num; i++) {

        if (num%i == 0) {
            solve(i,sum+i-1,num/i);
        }

    }

    res.push_back(sum+num-1);

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n;
    solve(2,0,n);

    sort(res.begin(), res.end());
    total = res.size();
    res.push_back(0);

    rep(i,0,res.size()-2) if (res[i] == res[i+1]) total--;

    cout << total << "\n";
    rep(i,0,res.size()-2) if (res[i] != res[i+1]) cout << res[i] << ' ';
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:5:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(i,a,b) for (int i = (a); i <= (b); i++)
      |                                        ^
toy.cpp:39:5: note: in expansion of macro 'rep'
   39 |     rep(i,0,res.size()-2) if (res[i] == res[i+1]) total--;
      |     ^~~
toy.cpp:5:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(i,a,b) for (int i = (a); i <= (b); i++)
      |                                        ^
toy.cpp:42:5: note: in expansion of macro 'rep'
   42 |     rep(i,0,res.size()-2) if (res[i] != res[i+1]) cout << res[i] << ' ';
      |     ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -