QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#175942 | #5503. Euclidean Algorithm | aaaaa | WA | 1068ms | 3876kb | C++14 | 2.3kb | 2023-09-11 06:14:10 | 2023-09-11 06:14:10 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
gp_hash_table<ll, ll> regular_table;
gp_hash_table<ll, null_type> hash_table;
ordered_set oset;
ll T;
ll N;
ll answer;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> T;
while (T--) {
cin >> N;
answer = 0;
for (ll i=1; (i*i*i)<=N; i++) {
if (i*(i*i+1) <= N) {
++answer;
}
answer += 2*max((N/i-1)/i-i, 0LL);
answer += max(N/(i*i+1)-i, 0LL);
for (ll j=i+1; i*j*j<=N; j++) {
if (i*(j+j+1) <= N) {
++answer;
}
if (j*(i*j+1) <= N) {
answer += 2;
}
answer += 2*max((N/i-1)/j-j, 0LL);
answer += 2*max((N/j-1)/i-j, 0LL);
answer += 2*max(N/(i*j+1)-j, 0LL);
}
}
cout << answer << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
3 2 5 14
output:
1 9 62
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 638ms
memory: 3528kb
input:
3 29107867360 65171672278 41641960535
output:
8921593237533 21300450379732 13136180138425
result:
ok 3 lines
Test #3:
score: -100
Wrong Answer
time: 1068ms
memory: 3876kb
input:
3 90076809172 100000000000 99913139559
output:
30192292781431 33790187414021 33758574429172
result:
wrong answer 2nd lines differ - expected: '33790187414013', found: '33790187414021'