제출 #267055

#제출 시각아이디문제언어결과실행 시간메모리
267055pedroslreyToys (CEOI18_toy)C++17
100 / 100
908 ms4728 KiB
#include <bits/stdc++.h>

using namespace std;

set<int> ans;

void calc(int n, int stop, int sum) {
	ans.insert(sum + n - 1);
	for (int i = stop; i <= n/i; ++i)
		if (n % i == 0)
			calc(n/i, i, sum + i - 1);
}

int main() {
	int n;
	scanf("%d", &n);

	calc(n, 2, 0);

	printf("%d\n", (int)ans.size());
	for (int x: ans)
		printf("%d ", x);
	printf("\n");
}

컴파일 시 표준 에러 (stderr) 메시지

toy.cpp: In function 'int main()':
toy.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...