QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#655924#9248. An Easy Math ProblemjieloscWA 62ms3896kbC++20984b2024-10-19 10:22:432024-10-19 10:22:43

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-19 10:22:43]
  • Judged
  • Verdict: WA
  • Time: 62ms
  • Memory: 3896kb
  • [2024-10-19 10:22:43]
  • Submitted

answer

#include <bits/stdc++.h>
#define int int64_t

using std::cin;
using std::cout;
const char endl = '\n';

std::vector<int> prime;
bool not_prime[(int)1.1E5];

void solve() {
  int n;
  cin >> n;
  int ans = 1;
  for(auto &p : prime) {
    int cnt = 0;
    while(n % p == 0) {
      n /= p;
      cnt++;
    }
    ans *= cnt * 2 + 1;
  }
  if(n != 1) ans = 3;
  cout << (ans / 2 + 1) << endl;
}

void init() {
  for(int i = 2; i < (int)1.1E5; ++i) {
    if(!not_prime[i]) prime.push_back(i);
    for(auto &p : prime) {
      if(p * i >= (int)1.1E5) break;
      not_prime[p * i] = true;
      if(i % p == 0) break;
    }
  }
}

int32_t main(){
  init();
#ifndef _DEBUG
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
#endif
  int tc = 1;
  std::cin >> tc;
  while(tc--) solve();
#ifdef _DEBUG
  std::cout << std::endl;
  std::cout << "Time used: " << clock() << "ms" << std::endl;
  system("pause");
  return 0;
#endif
}

詳細信息

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: 0
Accepted
time: 61ms
memory: 3896kb

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:

29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
...

result:

ok 2000 lines

Test #3:

score: -100
Wrong Answer
time: 62ms
memory: 3868kb

input:

2000
1763047095
79735483
1016286871
2864801397
2327774116
2668010360
3469893354
3634459021
1613699068
781737219
574741575
2763134701
1458502604
1822260248
2281150332
2924219311
2493931196
3735904708
158802001
2006921221
729928782
1974841034
727412600
2873393292
1291087179
2741607663
1893408215
29827...

output:

2
5
2
2
2
95
2
14
2
68
203
2
2
2
2
41
2
2
14
2
608
41
158
2
2
41
2
2
2
41
2
203
41
2
2
446
2
2
2
878
2
2
365
203
2
2
2
122
32
2
41
2
2
23
2
2
2
2
2
122
2
203
608
2
41
122
2
2
2
2
68
41
2
2
230
2
2
2
2
2
2
14
2
2
2
2
2
68
2
293
473
2
2
41
14
2
2
2
2
2
122
41
2
2
2
2
14
2
14
2
2
2
2
2
2
2
41
14
2
2
14...

result:

wrong answer 1st lines differ - expected: '14', found: '2'