QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#707910 | #9248. An Easy Math Problem | ThisTime | WA | 2ms | 3780kb | C++23 | 1.5kb | 2024-11-03 18:06:51 | 2024-11-03 18:06:52 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
// #pragma GCC optimize (1)
// #pragma GCC optimize (2)
// #pragma GCC optimize (3)
#define deg(a) cout<<#a<<'='<<a<<"\n"
#define all(a) a.begin(),a.end()
#define lowbit(x) ((x)&(-x))
#define find1(x) (__builtin_popcount(x))
#define pll pair<int,int>
#define all(a) a.begin(),a.end()
#define db double
#define endl '\n'
#define ff first
#define ss second
#define lc p<<1
#define rc p<<1|1
using namespace std;
using i64 = long long;
const int N = 1e6+10;
const int M = 1e6+10;
const int mod1 = 998244353;
const int mod2 = 1e9+7;
const int INF = 0x3f3f3f3f3f3f3f;
const double eps = 1e-10;
void solve(){
map<int,int>s;
std::vector<int> v;
v.push_back(1);
s[1] = 1;
int n;
cin >> n;
for(int i = 2 ; i * i <= n ; i++) {
if(n % i == 0) {
v.push_back(i);
while(n % i == 0) {
n/=i;
s[i]++;
}
}
}
if(n > 1) {
if(s[n] == 0) {
s[n] = 1;
v.push_back(n);
}
}
int ans = 0;
for(int i = 0 ; i < v.size() ; i++) {
int cnt = 1;
for(int j = i + 1 ; j < v.size(); j++) {
cnt *= (s[v[j]] + 1);
}
ans += s[v[i]] * cnt - s[v[i]];
}
ans++;
cout << ans << endl;
}
signed main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int kk = 1;
cin >> kk;
// cin.get();
while(kk--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3780kb
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
Wrong Answer
time: 2ms
memory: 3492kb
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...
output:
2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 2037 ...
result:
wrong answer 1st lines differ - expected: '29525', found: '2037'