QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#563984 | #9248. An Easy Math Problem | lonlyness | TL | 0ms | 3588kb | C++23 | 1.4kb | 2024-09-14 18:22:21 | 2024-09-14 18:22:22 |
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-09-14 18:22:21]
- Submitted
answer
// _ _ _
// | | ___ _ __ ___ | | (_) _ __ ___ ___ ___
// | | / _ \ | '_ \ / _ \ | | | | | '_ \ / _ \ / __| / __|
// | | | (_) | | | | | | __/ | | | | | | | | | __/ \__ \ \__ \
// |_| \___/ |_| |_| \___| |_| |_| |_| |_| \___| |___/ |___/
//
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<unordered_map>
using namespace std;
#define int long long
#define endl "\n"
const int N = 1e5 + 10, M = 1e5 + 10, inf = 1e9;
typedef pair<int, int> PII;
int n, m;
void solve() {
cin>>m;
vector<int>a;
for(int i = 1;i * i <= m;i ++){
if(m%i==0){
a.push_back(i);
a.push_back((m/i));
}
}
sort(a.begin(),a.end());
a.erase(unique(a.begin(),a.end()),a.end());
vector<PII>b;
for(int i = 0;i < a.size();i ++){
for(int j = i;j < a.size();j ++){
int tem = __gcd(a[i],a[j]);
b.push_back({a[i]/tem,a[j]/tem});
}
}
sort(b.begin(),b.end());
b.erase(unique(b.begin(),b.end()),b.end());
cout<<b.size()<<endl;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin>>t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
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...