QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#676005 | #9248. An Easy Math Problem | Gordensoul# | TL | 0ms | 3536kb | C++17 | 1.0kb | 2024-10-25 19:55:52 | 2024-10-25 19:55:52 |
Judging History
This is the latest submission verdict.
- [2024-10-31 22:36:43]
- hack成功,自动添加数据
- (/hack/1098)
- [2024-10-31 22:13:58]
- hack成功,自动添加数据
- (/hack/1096)
- [2024-10-31 22:00:43]
- hack成功,自动添加数据
- (/hack/1095)
- [2024-10-25 19:55:52]
- Submitted
answer
#include <bits/stdc++.h>
#define endl '\n'
#define int ll
using ll = long long;
typedef unsigned long long ull;
using namespace std;
int gcd(int a,int b)
{
if(a==0)return b;
return gcd(b%a,a);
}
void GordenGhost();
signed main() {
#ifdef Gorden
freopen("in.txt", "rt", stdin);
freopen("out.txt", "wt", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
GordenGhost();
return 0;
}
void GordenGhost() {
ll q,ff=0;
cin>>q;
while (q--){
ff++;
ll n,ans=0;
cin>>n;
vector<ll>w;
ll en= sqrt(n);
for (int i = 1; i <= en; ++i) {
if (n%i==0){
w.push_back(i);
if (n/i!=i) w.push_back(n/i);
}
}
int sz=w.size();
for (int i = 0; i < sz; ++i) {
for (int j = i; j < sz; ++j) {
if (w[i]*w[j]>n) break;
if (gcd(w[i],w[j])==1&&n%(w[i]*w[j])==0) ans++;
}
}
cout<<ans<<'\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
10 1 2 3 4 5 6 7 8 9 10
output:
1 2 2 3 2 5 2 4 3 5
result:
ok 10 lines
Test #2:
score: -100
Time Limit Exceeded
input:
2000 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 6469693230 646969323...