QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#711330#9531. Weird Ceilinghcysxnn#Compile Error//C++14909b2024-11-05 09:27:522024-11-05 09:27:53

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 09:27:53]
  • 评测
  • [2024-11-05 09:27:52]
  • 提交

answer

#include <bits/stdc++.h>
#define REP(i, l, r) for (int i = (l); i <= (r); ++ i)
#define DEP(i, r, l) for (int i = (r); i >= (l); -- i)
#define fi first
#define se second
#define pb emplace_back
#define mems(x, v) memset((x), (v), sizeof(x))
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(), (x).end()
using namespace std;
namespace Milkcat {
	typedef long long LL;
	typedef pair<LL, LL> pii;
	const int N = 1e6 + 5;
	LL n, rs; vector<LL> s;
	int main() {
		cin >> n, rs = 0, s.clear();
		for (LL i = 1; i * i <= n; i ++) {
			if (n % i) continue;
			s.pb(i), (i * i != n) && (s.pb(n / i));
		}
		LL lst = n + 1;
		sort(ALL(s), greater<LL>());
		for (LL x : s)
			rs += n / x * (lst - x), lst = x;
		cout << rs << '\n';
		return 0;
	}
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int T = 1; cin >> T;
	while (T --) Milkcat::main();
	return 0;
}

Details

answer.code: In function ‘int Milkcat::main()’:
answer.code:20:55: error: could not convert ‘Milkcat::s.std::vector<long long int>::emplace_back<long long int>((Milkcat::n / i))’ from ‘void’ to ‘bool’
   20 |                         s.pb(i), (i * i != n) && (s.pb(n / i));
      |                                                  ~~~~~^~~~~~~~