QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#463830 | #7797. Based Zeros | gjlccc | Compile Error | / | / | C++17 | 3.9kb | 2024-07-05 14:55:15 | 2024-07-05 14:55:16 |
Judging History
answer
#include <algorithm>
#include <array>
#include <atomic>
#include <bit>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <filesystem>
#include <format>
#include <fstream>
#include <functional>
#include <ios>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>
#ifdef DYNAMIC_PIGEON
#include "algo/debug.h"
#else
#define debug(...) 114514
#define dprint(...) 114514
#endif
#define Dynamic_Pigeon 0
using i64 = std::int64_t;
using u64 = std::uint64_t;
using u32 = std::uint32_t;
using std::cin;
using std::cout;
using std::string;
using std::vector;
constexpr i64 MOD = 998244353;
constexpr int INF = 0x3f3f3f3f;
constexpr i64 INF_LONG_LONG = 0x3f3f3f3f3f3f3f3f;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__)
std::map<i64, vector<int>> fp;
void I_LOVE_YOU() {
i64 n;
cin >> n;
{
auto it = fp.find(n);
if (it != fp.end()) {
i64 p = it->second.back();
int cnt = 0;
i64 t = n;
while (t) {
if (t % p == 0) {
cnt++;
}
t /= p;
}
print("{} {}\n", cnt, it->second.size());
for (auto x : it->second) {
cout << x << " ";
}
cout << "\n";
return;
}
}
int max = 0;
vector<int> ans;
i64 p = 2;
for (; p * p * p * p <= n; p++) {
int cnt = 0;
i64 t = n;
while (t) {
if (t % p == 0) {
cnt++;
}
t /= p;
}
if (cnt > max) {
ans.clear();
ans.push_back(p);
max = cnt;
} else if (cnt == max) {
ans.push_back(p);
}
}
if (max >= 4) {
print("{} {}\n", max, ans.size());
for (auto x : ans) {
cout << x << " ";
}
cout << "\n";
fp[n] = ans;
return;
}
for (; p * p * p <= n; p++) {
int cnt = 0;
i64 t = n;
while (t) {
if (t % p == 0) {
cnt++;
}
t /= p;
}
if (cnt > max) {
ans.clear();
ans.push_back(p);
max = cnt;
} else if (cnt == max) {
ans.push_back(p);
}
}
if (max >= 3) {
print("{} {}\n", max, ans.size());
for (auto x : ans) {
cout << x << " ";
}
cout << "\n";
fp[n] = ans;
return;
}
for (; p * p <= n; p++) {
int cnt = 0;
i64 t = n;
while (t) {
if (t % p == 0) {
cnt++;
}
t /= p;
}
if (cnt > max) {
ans.clear();
ans.push_back(p);
max = cnt;
} else if (cnt == max) {
ans.push_back(p);
}
}
if (max >= 2) {
print("{} {}\n", max, ans.size());
for (auto x : ans) {
cout << x << " ";
}
cout << "\n";
fp[n] = ans;
return;
}
for (i64 i = 1; i * i <= n; i++) {
if (n % i == 0) {
i64 p = n / i;
int cnt = 0;
i64 t = n;
while (t) {
if (t % p == 0) {
cnt++;
}
t /= p;
}
if (cnt > max) {
ans.clear();
ans.push_back(p);
max = cnt;
} else if (cnt == max) {
ans.push_back(p);
}
}
}
std::sort(all(ans));
ans.resize(std::unique(all(ans)) - ans.begin());
fp[n] = ans;
print("{} {}\n", max, ans.size());
for (auto x : ans) {
cout << x << " ";
}
cout << "\n";
}
signed main() {
#ifdef DYNAMIC_PIGEON
freopen("input.in", "r", stdin);
#else
std::cin.tie(0)->sync_with_stdio(0);
#endif
int t = 1;
cin >> t;
while (t--) {
I_LOVE_YOU();
}
return Dynamic_Pigeon;
}
详细
answer.code: In function ‘void I_LOVE_YOU()’: answer.code:54:41: error: ‘format’ is not a member of ‘std’ 54 | #define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__) | ^~~~~~ answer.code:74:7: note: in expansion of macro ‘print’ 74 | print("{} {}\n", cnt, it->second.size()); | ^~~~~ answer.code:54:41: error: ‘format’ is not a member of ‘std’ 54 | #define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__) | ^~~~~~ answer.code:105:5: note: in expansion of macro ‘print’ 105 | print("{} {}\n", max, ans.size()); | ^~~~~ answer.code:54:41: error: ‘format’ is not a member of ‘std’ 54 | #define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__) | ^~~~~~ answer.code:133:5: note: in expansion of macro ‘print’ 133 | print("{} {}\n", max, ans.size()); | ^~~~~ answer.code:54:41: error: ‘format’ is not a member of ‘std’ 54 | #define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__) | ^~~~~~ answer.code:161:5: note: in expansion of macro ‘print’ 161 | print("{} {}\n", max, ans.size()); | ^~~~~ answer.code:54:41: error: ‘format’ is not a member of ‘std’ 54 | #define print(s, ...) std::cout << std::format(s, ##__VA_ARGS__) | ^~~~~~ answer.code:193:3: note: in expansion of macro ‘print’ 193 | print("{} {}\n", max, ans.size()); | ^~~~~